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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.