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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.