Forum Moderators: coopster
Can anyone help?
I'm making a few web forms on my page.
When I press the submit button, I run a validator, to check if the form is filled out properly. If not, I give an error msg, and then I print out a link saying "go back and correct" with href=javascript:history.go(-1) as the url.
This works well. Only problem is that when I press this link, my form looses all of it's values, so if a user does something wrong when filling out the values, he/she has to do it all over again, starting from scratch.
I use sessions, and I'm sure it has something to do with this...
I want the values to still be there when I direct the user back to the form, after the error msg.
Anyone have any suggestions, except putting it all in cookies?
<input type='text' name='fname' value='<? echo $_SESSION["fname"];?>' /><br />
<input type='text' name='lname' value='<? echo $_SESSION["lname"];?>' /><br />
<input type='text' name='username' value='<? echo $_SESSION["username"];?>' /><br />
Alternately, if you aren't storing them in sessions, then you can just set the printing of the form in a function, and call it if they didn't fill everything out. And instead of using $_SESSION, just use $_POST and it should still work.
Just use the value attribute to set the value!
Good luck!
[edited by: eelixduppy at 10:34 pm (utc) on June 1, 2006]