Jump to content

"Keep" data in form when refreshed


Vivid Lust

Recommended Posts

This is a portion of code from a site I worked on before...

 

<b>City:</b> <input type="text" value="<?php echo $city; ?>" name="city" size = "20"><br /><br />
<b>State:</b> <input type="text" value="<?php echo $state; ?>" name="state" size = "20"><br /><br />
<b>Zip:</b> <input type="text" value="<?php echo $zip; ?>" name="zip" size = "20"><br /><br />

 

If you are losing the actual values in transition of going from one page to the next then you may want to look into php sessions to store them temporarily on the second page and then refresh back to the first.  There is a little more to it than that but I think you get the idea. 

 

The more important issue you need to deal with is why are you even leaving the page if everything is not properly in order?  I submit to the page itself (the page the originally contained the form), do all error checking (on that page) and then IF and only IF everything is perfect THEN leave the page.  If not then print the form to the screen again with all user variables already filled in for the end user.  Otherwise you are just sending data back and forth and looking for issues.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.