|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
keeping form data when a jump menu refreshes page
I dont know whether this is specifically a php problem, but im using it in these forms anyway.
Ive got a jump menu called "select" which when an options selected it reloads the page with an extra drop down menu below it related to the choice youve made. <select name="select" onChange="MM_jumpMenu('parent',this,1)"> <option selected>Services...</option> <option value="corporate_send.php?select=choice">choice </option> which then would reload the page.... and anything after this tag would be displayed <? if ($select == "choice") { ?> all this is working fine. There are several fields before this which lose their data when the page refreshes. Is there any way of saving/ getting the jump menu to repost the data in these fields when it is selected - so the user doesnt have to type it in again? any pointers would be fantastic. thanks duncan |
|
#2
|
|||
|
|||
|
You could write an on click event for the links that builds a query string sent to the new page and get your php script to re-populate the form from that.
-KM- |
|
#3
|
|||
|
|||
|
its the repopulating the fields bit which is confusing me - any ideas?
|
|
#4
|
|||
|
|||
|
Duncan,
I may be wrong here, but how about temporarily storing the data either in an array or in a session object. The event that's called by changing the menu could store the form values just before the page refreshes, and then you can re-populate the fields based on the stored data. Any other takers on this one? I'd love to hear other suggestions...
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#5
|
|||
|
|||
|
I would either create the query string from the data or put it into session data as FrankieShakes suggested. Then when you are creating the form again on the next page you have access to all the information you need to repopulate the form.
For example lets say we use the session data option (so all our variables are in $_SESSION ['var_name']) and we have a variable in there called var1 which we want to put into the first text box in the form. Then when we create the textbox we can add some php to the value property it has to enter in the session data. Code:
<form blah...> <input type="text" name="var1" value="<?php echo $_SESSION ['var1']; ?>" /> </form> The same code will work for using the query string option by replacing $_SESSION with $_GET instead. Hope this helps, -KM- |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > keeping form data when a jump menu refreshes page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|