Jump to content

[SOLVED] PHP form checking


imperialized

Recommended Posts

Ok, so I created a form that validates with ajax

 

if an error is encountered, it will return a value.

 

example:

The original code is this:

<tr>

<td width=350>

<b>Email Address:</b><br>

<font size=2>*Email address MUST be valid in order to play.</font>

</td>

<td>

<span id=\"email_chk\">

<input id=\"email\" name=\"email\" type=\"text\" class=\"reg_form\" maxlength=\"80\" onblur=\"check_email(this.form)\">

</span>

</td>

</tr>

 

 

the returned code is this:

print "<input id=\"email\" name=\"email\" type=\"text\" class=\"reg_form\" maxlength=\"80\" style=\"$failed\" value=\"$email\" onblur=\"check_email(this.form)\"> $x <br>

<font size=1.5 color=red>Email does not match!

 

--->  <input type=hidden name=\"email_error\" value=\"1\">

 

sets the error value to 1

 

When I call my javascript:

 

      var email_error=document.registration_form.email_error.value;

if(email_error == 1){

alert('Check your email!');

return false;

}

 

The javascript doesn't catch anything or provide an alert... I dont know javascript for shit so I am lost

Link to comment
https://forums.phpfreaks.com/topic/144871-solved-php-form-checking/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.