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.  

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.

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).

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.