Hi,
i have a html form, and use php to validate the inputs. Basically the validate.php validate the input, if all inputs are good, it will call header("location:anewpage.php") to open a new page. if any input is invalid, it will call header("location:userinput.html") to go back to the form.
my problem is when there are invalid inputs, it will go back to the user form, but all the input values are gone, its like hitting refresh button.
how can i keep all the values when it returns to the form page?
Thanks
need help with form validation
Moderator: General Moderators
Set an initial value for the form fields. For example, if you've included an html template, add:
value="<?php echo $var; ?>"
If you did the form in php (or eval'd a html template), leave out the php tags and the echo, ie just insert the var.
The vars have to be declared in the script that calls the form before the form is built.
value="<?php echo $var; ?>"
If you did the form in php (or eval'd a html template), leave out the php tags and the echo, ie just insert the var.
The vars have to be declared in the script that calls the form before the form is built.