Re: Form validation issue
| From: | tedd | Date: | Thu, 24 Dec 2009 15:21:37 +0000 |
| Subject: | Re: Form validation issue | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-300676@lists.php.net to get a copy of this message | ||
At 3:10 PM +0530 12/24/09, kranthi wrote:
The javascript function formValidator() must return false if any errors are formed.I forgot to mention that $_POST does hold on to the values as well -- so, one could use that. However, you still have to repopulate the form and that was what I was getting at. Cheers and Merry Christmas. tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.comYou should definitely have a better validation than that. Remember that all users dont have javascript enabled. Moreover it is very easy to modify the request variables.The PHP only runs if the fields are set by testing using 'isset".This is true when the page is refreshed but I doubt that is the case here. Since $_SERVER['PHP_SELF'] is being used I think value="<?php echo $_POST[...] ?>" will be sufficientHowever, if the server-side evaluation fails and the page is refreshed, then all the previous values are lost -- UNLESS -- you keep them in a cookie, database, or session. I suggest using a session.