Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
09-21-2006, 12:26 AM #1
- Join Date
- Sep 2006
- Thanked 0 Times in 0 Posts
User entered data disappears on goback
I have a simple HTML form for my visitors to fill out some input fields. This information gets validated by a php function that either 1. accepts the data and emails it to me OR 2. tells the client that there is something wrong with his data entry that he needs to correct (one or more obligatory fields missing; no @ in the email name; etc.) and sends the client back like this
echo "<FORM method=\"POST\" name=\"GoBack\">\n";
echo "<p style=\"style5\">Please enter a valid email address.<\p>\n";
but the data that the client has entered disappears.
My question: How do I make sure (as much as possible) that the client does not have to re-enter all the fields again?
Thank you for anyone who can help me on this issue!
09-21-2006, 06:43 AM #2
- Join Date
- Aug 2006
- Thanked 1 Time in 1 Post
after validation you just put the variables in the value field of the form before sending the html. So in your example that should be easy.
if you initialise the form variables to "" on a GET and always do as above, then there is no difference to code between a get and a post except deciding whether its a get or a post and performing the relevant code before formatting the form output.