homepage Welcome to WebmasterWorld Guest from 54.237.98.229
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Form Results Directed to PHP Page
slappboy

10+ Year Member



 
Msg#: 1066 posted 5:05 am on Nov 8, 2002 (gmt 0)

OK... this is an oddball thing I want to do. I am trying to get a search form's results to show up in a page that does not exist until a user clicks on submit.
I have a mySQL backend in which the code for the results page is stored. Within the code is the definition of an iframe in which I would like the results of the form to be displayed.
I use PHPNuke and I want the results of a form located on the home page to open in the same window but still within my site. I don't want the iframe on the home page so it just will not exist until the code is pulled from the datbase and displayed in a browser window.
In the form you can obviously define a target window, but the target does not exist yet. I have played with using javascript to open the results page from the form but I can not get the target to show in the iframe.
I may be making this more complex than it needs to be but if anyone has any ideas please post them.
Thanks

 

seindal

10+ Year Member



 
Msg#: 1066 posted 11:17 am on Nov 8, 2002 (gmt 0)

Hi,

I think you have to pass the form variables through the first result page manually.

I understand you problem like this:
You have a page A where a form submission results in a page B which contain an iframe C where you want the form result to appear.

The target on the form on page A has to be page B. When generating page B (I assume it is dynamic) you insert the values of the form variables in the url in the SRC attribute of the iframe, so you can generate the content of the iframe.

So you have to send you form data to page B, even though you want the result shown in iframe C.

Maybe you should see if you can find another way of structuring you pages so you avoid having to bend over backwards like this. What I think you want to do can be done, but it is overly complicated, so it is better to find a simpler way. Follow the KISS priciple. It always pays off.

René.

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 1066 posted 6:08 pm on Nov 8, 2002 (gmt 0)

Welcome to WebmasterWorld [webmasterworld.com] slappboy

The page has to exist somehow. I assume you mean that if you go to the page/script without going throught the form you won't get anything on the page. If so no problem.

In the form you can obviously define a target window

I don't really understand this. Do you want it to open in a new window or the same window or the same page?

This is the way I see it. Your form has its fields etc on the main page. If you want it to open in a new window your submit button can be a button that calls a js function. This function can create a new window with the size and attributes you want. It can then submit the form and send it to the target window. The page/script that is opened in the new window then creates the iframe and fills it full of results.

that's one scenario.

I am still not sure if the iframe is on the same page. I am not really too sure where you want the iframe to show up. If it is on the same page you can post it to itself and reload the page and the results will pop into the iframe on reload.

You'll have to tell me if I came anywhere near the mark your post is a little confusing.

slappboy

10+ Year Member



 
Msg#: 1066 posted 7:28 pm on Nov 8, 2002 (gmt 0)

You both seem to understand basically what I would like to do. So ... Picture this.
You have a main home page... that page is created by a set of pre-designed PHP scripts (PHPnuke) and the content (text/html) stored in a database. The only way to get something to show up on this page is to either modify the main scripts or enter your own code in some predefined database table to be displayed in a dynamically generated table somewhere on the page. I have added the code for a form in the database that will show up on the main page in a small table. For example: a weather search. Now when a user enters the info into the form and clicks submit the results could be displayed in a new window or the same window or even an iframe that exists on the main page somewhere. I don't want a blank iframe taking up space on my home page and I don't want the forms results to load in the same window and cause my page to disappear. Opening a new window is OK but I would rather keep the page's links and menus in the same window so navigation would flow more smoothly and someone does not have to keep swapping between open browser windows.
I just can't figure out how to get the results page to be sent to a dynamic page that would be displayed within the websites structure. Kind of like the chicken and the egg routine. I want to send the chicken back to his own egg. :-)
I would like to keep the main scripts basically the way they are so I can benefit from future updates and not have to change the scripts each time I get a newer version. So this leaves me no choice but to figure a way of getting the form to open the dynamic page that exists within my site and then placing the results on that page. Even if the original form did nothing but send the user imputed data to the dynamically generated pages form to be actually processed. This is a brain squeezer

Thank you in advance for any advice!

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 1066 posted 10:35 pm on Nov 8, 2002 (gmt 0)

It sounds like, for you want to do, you would need to rework a script and that isn't what you want to do.

I don't know how you create new pages in phpnuke so I can't really tell you how to do that but you obviously need a new page. In your content you will just need to use php to access the vars you passed from the form and use them to output the content.

You'll have to correct me if I'm oversimplifying but that seems to be your answer.

Next question, are you comfortable enough in php to do so? You could also create a page of your own design that outpus your results.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved