Posted by peebrain on 06/25/05 01:51
I understand how to validate form data when a form is submitted to
'self' (ie. action="$_SERVER_[PHP_SELF]"). In this case you simply
validate before processing. However, what if submitting the form to
another page (ie. action="someotherpage.php"). You could validate the
form data on the new page but it makes more sense to validate first
before submitting, plus if there are errors, then you have to send the
user back to the first page. There must be a way to do the error
checking before the submit. The only way I can think to do this is with
Javascript and a button element onclick event (instead of Submit button)
with the Javascript handling the form validation and form submit. There
is probably a real obvious PHP solution but I can't see it.
[Back to original message]
|