I have made an example of the Gmail username style signup page. Where you enter your selected username and click Check Username the script will then check to see if the username is taken if so make some suggestions as to others like that one which are available.
The example uses PHP and AJAX (via Sajax development version) to complete this task.
You can see the example and see the source code.

July 21st, 2005 at 12:59 pm
I simply love the demo! That’s Ajax or stay with ya mom’
August 15th, 2005 at 3:09 pm
Would it be possible to make it check for the username automatically and also mergin it with the suggestion if the name is alredy taken without having to submit the form?
November 6th, 2005 at 9:58 pm
wonderful!
November 15th, 2005 at 7:37 am
it shld chk for username in realtime w/o pressing the [Check Username] button.
December 17th, 2005 at 5:20 pm
cool stuff, i like it. I’ve just started learning AJAX, and your website is very helpful
December 18th, 2005 at 12:52 am
AWSOME, thanks for the script man, much appreciated
February 10th, 2006 at 1:25 pm
to make it check in realtime: don’t use the onPress, instead use a onBlur=”check_user_exist(); return false;” at the input field. Script works fine!
March 3rd, 2006 at 7:21 pm
This is exactly what I’m looking for, thanks.
March 4th, 2006 at 4:31 am
I got inspired by your code to make a simple AJAX login.
Username and password with a submit button.
anyways, just wanted to post some code in case someone is curious how it works with SAJAX.
Untitled Document
function do_getUserId(username){
if (username==0) {
document.getElementById(’loggedout’).style.display = ‘none’;
document.getElementById(’loggedin’).style.display = ‘block’;
}
if (username==1){
document.getElementById(’loggedin’).style.display = ‘none’;
document.getElementById(’loggedout’).style.display = ‘block’;
var str = ‘Sorry that username is not found ‘;
document.getElementById(’loggedout’).innerHTML = str;
}
if (username==2){
document.getElementById(’loggedin’).style.display = ‘none’;
document.getElementById(’loggedout’).style.display = ‘block’;
var str = ‘Sorry the password is wrong, enter again ‘;
document.getElementById(’loggedout’).innerHTML = str;
}
}
function getUserId(){
var x,y;
x = document.getElementById(”username”).value;
y = document.getElementById(”password”).value;
x_getUserId(x,y,do_getUserId);
}
#loggedin {
display: none;
color: grey;
}
#loggedout {
display: none;
color: red;
}
Username
Password
User is logged in!
Sorry that username/password is not found.
March 22nd, 2006 at 2:03 pm
Comprobando nicks con AJAX.
Son muchas la páginas que cuando vas a escribir el nombre de usuario con el que quieres registrarte, te muestran al lado un botón para comprobar si dicho nombre está ya ocupado o no, y si lo está te muestra una lista con posibles nombres que no lo…
March 29th, 2006 at 4:19 am
Hi Andrew.
It dint work. Can u give me the proper version. I would like to see. Im juz a novice. Sorry if i’m wrong. Plz clear it.
April 24th, 2006 at 7:46 pm
Hey,
Can you tell me how to get this working with mod rewrites? Right now how my system works is mydomain.com/register.php shows as mydomain.com/register. When I try the script at mydomain.com/register.php (without the rewrite) it works fine but when I try it at mydomain.com/register (with mod rewrite) it does not. If you can help me that would be great, I have left my email. I really want to use this on my website but I need to have it working with the rewrites.
Thanks
April 28th, 2006 at 5:36 pm
Nice one.. thanks for the demo -, I’m developing a portal, I’m novice to ajax, this is exactly what I was looking for.
Thanks again.
Marian
May 13th, 2006 at 9:03 am
Great example!
I created a very nice user registration system using instant ajax validation.
June 19th, 2006 at 8:25 pm
Does anyone know a similar perl script to do this, like as the one on ebay.
Thanks
August 9th, 2006 at 2:26 am
Cool Man, Thanks
I was looking for this coding from many weeks.
I am looking for wordpress type comment coding
Vinit
September 1st, 2006 at 1:31 pm
Hi, fantastic! But is there a kind of addon where it doesnt allow alphanumeric - / : ” £$%^ and things?
October 2nd, 2006 at 8:46 pm
Excellent code.
I have made modifications to this and can do many things with it… however one thing I cannot do is check boxes. It always says it is on even though it is not.
November 25th, 2006 at 4:48 pm
Hi,
Thank you very much for providing such a brilliant idea, its really works great.
thank you again
best regards,
Aziz A. Khan
December 14th, 2006 at 12:55 am
Any coding on trim the user_name between database field name & text box?
December 15th, 2006 at 6:24 am
Postgres database support this?I try on my side. Unfortunately, case sensitive check was failed. Anyone can help me on that.
Thanks Thanks!
January 5th, 2007 at 5:20 pm
thanks the script is nice, but i currently have a problem, my url is type www.2vif.com/newuser/new.php?K=xxxx
usin this generate an error, could you help me? am a real newbie in ajax….
February 22nd, 2007 at 12:40 pm
A problem which you discuss on your site is very important for me. Thank you for your resume.
February 28th, 2007 at 12:16 am
[…] Gmail style, AJAX check username signup […]
February 28th, 2007 at 12:52 am
[…] Gmail style, AJAX check username signup […]
March 5th, 2007 at 4:53 am
[…] Gmail style, AJAX check username signup […]
March 6th, 2007 at 6:07 am
[…] Gmail style, AJAX check username sign up […]
April 14th, 2007 at 9:46 am
Gmail style, AJAX check username signup
I have made an example of the Gmail username style signup page. Where you enter your selected username and click Check Username the script will then check to see if the username is taken if so make some suggestions as to others like that one which are …
May 17th, 2007 at 9:57 am
Is there a .asp version of this great script.
I use .asp and ms access.
if you have the same in .asp please mail me. I need it very hard.
thanks in advance.
June 28th, 2007 at 8:44 am
Its really a very nice script. this is my first implementation of ajax in my website.
i really had a fun using this script. Very good script.
Only one improvement which i want to have in this script, is that it should show available usernames suggesstion.
it shows the username for a array, what if the username mentioned in that array is already taken.
it should show the unique suggestions which are not already taken.
rest a brilliant script.
full credits to the person who has developed this script.
July 30th, 2007 at 5:31 pm
is there an easy way to make it not suggest names and just say not available?
August 14th, 2007 at 8:16 am
hi…
i have one question in ajax concept..
1.click the submit button display the database fields..
September 6th, 2007 at 12:20 pm
ı have user sytem where is error
orginal code:
$sql = “SELECT `username` FROM `users` WHERE `username` = ‘$username’”;
my code :
$sql = “SELECT `username` FROM “.$dbprefix.”`users` WHERE `username` = ‘$username’”;
please help
September 6th, 2007 at 7:15 pm
askin, the correct code is
$sql = “SELECT `username` FROM “.$dbprefix.â€.`users` WHERE `username` = ‘$username’â€;
notice the period (.) seperating the database name and table.
September 7th, 2007 at 5:04 am
NOT WORKING
my files..
config.php
login form :
0) {
// Username not available
$avail[0] = ‘no’;
$i = 2;
// Loop through suggested ones checking them
………………………
Error Text :
+: Error :Table ‘test.musterikart’doesn’t exist
why dbprefix not read ?
$dbprefix = ‘xxx_’;
September 14th, 2007 at 1:37 am
askin, try this code:
$sql = ”
SELECT `username`
FROM ‘” . $dbprefix . “users`
WHERE `username` = ‘$username’
“;
If you need a period (.) seperating the db prefix and table, just add it after the double quote (”).
September 20th, 2007 at 7:14 pm
Can anyone figure out why it returns an error when using this in a lighbox? Check it on my site, the third link titled ‘User Check’ http://ajax.llpool.com
September 21st, 2007 at 12:45 pm
OK, got it working. I had the php stuff coming after the headers so it was bombing out.
September 23rd, 2007 at 12:29 pm
there is also a large and comprehensive database of 500+ ajax scripts available with over at ajaxflakes’s ajax scripts compound
thought i should add it might be helpful to others…
October 6th, 2007 at 9:13 pm
excellent script, can such a script be available to check for domain availibility ?
October 7th, 2007 at 1:49 pm
please fix, it’s not working when i using charset=”utf-8″
October 12th, 2007 at 9:42 pm
Will this work in MediaWiki? If it does, whats the best way to implement this so when you type in the a word, it’ll prompt you whether a “Page” is taken or not?
November 23rd, 2007 at 12:30 pm
Is it possible to change this script around so that when it query the db for username and returns that one is taken, to have some code that will radomly pick from the ad ons instead of taking the first few available, if any are available.
It would be really cool if you could have like 100 -200 suggestions in there and the script randomly picked 4 of the available.
November 23rd, 2007 at 1:09 pm
hi , Thanks for your brilliant script
i used it and it works fine ,, but when i implement it to other pages , i mean when i write :
include(”username-ajax.php”);
then :
when i click on check button it shows me a error window with this content :
http://www.mahlaghabonbon.com/error.gif
any suggestion ?
tanx
November 24th, 2007 at 8:29 pm
You are awesome, good job, keep it up, posted from HK
May 21st, 2008 at 9:09 am
[…] Gmail style, AJAX check username signup […]
June 4th, 2008 at 8:00 pm
[…] 30. GMail Ajax Style Username Signup […]
June 11th, 2008 at 11:57 pm
[…] Gmail style, AJAX check username signup […]