Ask about general coding issues or problems here.
4 posts • Page 1 of 1
I know there are ways to resubmit the user info but I'm a novice and I can only do so much. As of now my form vaildation will display ex. "You must fill in your address" on a seperate page. If I somehow make a back button on that page using php will the info the user filled into the form stay there? Does it depend on the browser?
- php-forum Active User
- Posts: 266
- Joined: Tue Apr 08, 2003 5:18 am
- Location: Ottawa, Canada
- Posts: 2272
- Joined: Sat Jul 05, 2003 1:18 pm
- Location: A bunk in the back
This is the second time I've answered this question today. The usual method is to make the form submit to itself (i.e. <form action="<?= $_SERVER['PHP_SELF'] ?>" ...>). Then on the page with the form, check to see if the form has been submitted. If it has, do your validation, and if anything is missing, display the form again with all the submitted information filled in (i.e. <input type="text" name="username" value="<?= $_REQUEST['username'] ?>">) and highlight the fields that the user missed. For the record, form validation is a pain in the arse. I recommend reading one of the dozens of good form validation tutorials that Google will find for you and/or don't reinvent the wheel and just download someone else's script.
Who is online
Users browsing this forum: Google [Bot] and 5 guests