Jump to content

Double validation PHP and Ajax


soundsticks

Recommended Posts

Step 1: Add Javascript validation that validates after the user is finished inserting info.

Step 2: Add PHP to check the submitted data when the user submits the form.

 

But I'm using Ajax already on my register form and when user try to select/insert the user that he wish it will show whether the username is available or taken by others.  

Link to comment
Share on other sites

Step 1: Add Javascript validation that validates after the user is finished inserting info.

Step 2: Add PHP to check the submitted data when the user submits the form.

 

I have to disagree slightly. Server-side validation should be #1 and a requirement. Client-side validation is a "nice to have" but not a necessity, so it should be considered #2.

Edited by Psycho
Link to comment
Share on other sites

Client side validation is markup (great for validating charsets and such), server side validation is real deal.

 

However, the signup issue you describe only occurs on ajax calls and not when you try to do it via the traditional method? One method that always work is just making the user name unique in the database table, its not that pretty though (you'd run an UPDATE IGNORE and check how many rows were actually affected to see if the add worked).

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.