|
Posted by Rik on 06/24/06 16:58
h7qvnk7q001@sneakemail.com wrote:
> I'm trying to implement a simple server-side form validation (No
> Javascript). If the user submits a form with errors, I want to
> redisplay the same form with the errors highlighted. Once the form is
> correct I need to submit to another page that uses the form data.
I assume the redisplaying & highlighting errors is not the problem?
> I first tried making the form submit action= field point to the same
> file. When the form was correct, I tried loading the next page by
> using <META http-equiv refresh>. But that doesn't post the data, so
> the next page didn't have access to it.
In rederecting POST data is indeed lost.
There are several solution:
1. Use the same file for processing the data. (if it's a light application
it's the easiest one).
2. Use a temporary table in which you store the valid post data, preferably
with some auto_incremented key, which you can use as a GET variable on the
redirect (major security leak: other visitors can see what the rest is
doing).
3. Use sessions, and store the valid posted data into the $_SESSION, use
those values in the processing on the other page.
Grtz,
--
Rik Wasmus
[Back to original message]
|