Validate Form with PHP AND Javascriipt?
- by J M 4
Is it possible to validate a form with PHP AND Javascript? I am currently able to do both using my existing form but only on an individual basis.
My overall goal is this:
Validate form using javascript client side and present any errors to the user immediately
If javascript validation passes, a flag is created and then the PHP script can begin.
When doing my javascript validation, i use the following code within the form tag:
<form id="Enroll_Form" action="review.php" method="post" name="Enroll_Form" onsubmit="return Enroll_Form_Validator(this)" language="javascript">
if I want to process the PHP validation, I am forced to rename the action to the PHP_SELF file (or simply the same file name i'm using) and remove the 'onsubmit' function.
Any ideas?