Vivid Lust Posted June 12, 2009 Share Posted June 12, 2009 Any ideas how I can keep current data in a form when the page is refreshed? Thanks, Jake. Quote Link to comment Share on other sites More sharing options...
Vivid Lust Posted June 12, 2009 Author Share Posted June 12, 2009 To add to that, the form directs to x.php and if there is an error it goes back to y.php (where the form is) Quote Link to comment Share on other sites More sharing options...
Vivid Lust Posted June 12, 2009 Author Share Posted June 12, 2009 anyone? Quote Link to comment Share on other sites More sharing options...
cunoodle2 Posted June 12, 2009 Share Posted June 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.