Page 1 of 1

Forward variables to the next page?

Posted: Sun Feb 01, 2004 11:54 pm
by Stryks
Hi,

What I have is a registration form, which when submitted goes to a php script which then validates the data (checks lengths and makes sure no invalid chars are used, checks validity of email addy, etc) and if it is valid it submits the data to mysql, an account is made, and you go to the next page.

If it is not valid, it sends you back to the calling form so you can fill it in properly. I would like to carry the correct values across to the calling form should something be wrong, to help speed up the re-entry.

Is this possible, and if so, how?

Thanks

Posted: Mon Feb 02, 2004 12:14 am
by microthick
If you make the registration page and the validation page the same page, you don't need to worry about this!

Upon successful validation (if no errors) header() to the next page, else show the errors and auto-fill the text boxes with the $_POST data.

Posted: Mon Feb 02, 2004 12:39 am
by Stryks
That makes good sense. :)

How would I use the $_POST values to autofill the fields though?

Through the forms elements 'value' property?

Posted: Mon Feb 02, 2004 2:32 am
by microthick
right.

<input type="text" name="firstname" value="<?= $_POST["firstname"] ?>">