How to deal with errors in forms
| From: | Merlin | Date: | Thu, 24 Aug 2006 09:40:17 +0000 |
| Subject: | How to deal with errors in forms | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-241073@lists.php.net to get a copy of this message | ||
Hi there,
I do have a form where there is also a field with max 2000 characters the user can put in.
Now before processing the data with php, I do a checkin the script for certain criterias if something lookes wrong I do redirect him to the original form with inserting the data he has entered. I do this via GET
e.g.: ?title=test&body=blablub
That works fine with one exception. If the user does enter 2000 characters (or a lot c.) they do get transfered via URL as well and that is not possible. Firfox for example then simply displays a blank page!!! It would be fine if he would return with just a few less characters, but at least display the error message I am providing.
Now, 2 questions:
1) Does anybody know why firefox is shoing a blank page? If the URL does contain less characters, lets say 100 everything works fine.
2) How could I possibly save his entry? Maybe with the help of a cookie? But then, I do redirect to the page. So I do send a header. As far as I know this only once possible?
For example:
setcookie('bla test'); HEADER("Location:".$data[rurl]."?error=".$error.$parameter);
I would rather not like to use the help of a database.
Any ideas?
Regards,
Merlin