Like This Site? 
 
RSS Feed Follow Us 

on Twitter! Be Our Fan!

Check for Available Username with CakePHP, Ajax and jQuery

Share this post!
 Vote this!


When a user registers for your web site, it is usually a requirement that they have to select a unique username. It can be a pain when your usual usernames are taken. You keep submitting the form just to wait and then see an error message that the username is already taken. Using Ajax to check and see if a username is available before the user submits the form will make your registration page more friendly. Here is one method for doing it using CakePHP, Ajax and jQuery.
First, we are going to create a very lighweight user model. We will just use a username, password and email address. Let’s start by creating our database table:

1    CREATE TABLE users (
2    id integer NOT NULL auto_increment,
3    username varchar(20) NOT NULL,
4    password varchar(40) NOT NULL,
5    email varchar(100) NOT NULL,
6    PRIMARY KEY (id),
7    UNIQUE KEY username (username)
8    );                     

More...

0 comments:

Post a Comment