Forum Moderators: coopster
I'm new in the forum and coding with PHP and MySQL. I'm using HTML forms an get the items in the form to be validated by a PHP script.If i encounter an error in the form i use a PHP include() function to re call the HTML form.
I want to put back the values in the text boxes where there are no errors.How do i do that?
In the form, you specify values fed by php variables:
<input type="text" name="address" id="address" value="<?php echo $address;?>" />
Don't forget to define the variables (likely empty: $address = ''; ) on first display of the form so you don't generate errors.
If you subsequently redisplay the form you set the variables to the posted values instead of blanks or defaults. If you have a textarea, the value gets placed between the beginning and ending tags.