reloading forms and keeping variables.
| From: | Adrian Smith | Date: | Thu, 27 Jul 2000 21:56:10 +0000 |
| Subject: | reloading forms and keeping variables. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-8674@lists.php.net to get a copy of this message | ||
Hi
I have a form that the user fills in which is then reloaded to check to all
the fields are filled correctly, if they are not, variables are changed to
the value of 1 which the page then picks up on and alerts the user to fill
in each field that isn't correct, however, the page does not keep the values
of the fields the user has filled in already, its as if the user just loaded
the page.
Is there any way to keep these values when the page is reloaded ?
Here is a shorten example of the form layout and code I am using.
Mark = 2, once the user clicks submit, to trigger the page to reload using
$PHP_SELF and check for un entered fields like this one.
if(!$Num_adults and $mark==2):
$adult1=1;
endif;
<form action=\"$PHP_SELF\" method=\"post\">
form goes here
triggered error message
if($adult1==1):
echo"error message";
endif;
more form fields
<input type=\"hidden\" name=\"mark\" value=\"2\">
<submit>
</form>
Any help any one can give me with this would be greatly appreciated as I
have ran out of ideas to keep the variables!!
Many thanks
Ade !
------------------------------------------------------
ade@stormbreaker.com
------------------------------------------------------