Web Analytics Made Easy -
StatCounter Checking if username exists - CodingForum


No announcement yet.

Checking if username exists

  • Filter
  • Time
  • Show
Clear All
new posts

  • Checking if username exists


    I have a registration form. I would like it to whether the writtern username exists or not. When user have typed blahblah it should connect to a PHP script and get info about "does the username exist".

    How would I exactly do that?
    PHP 5 & MySQL 5 (Y)

  • #2
    The form which includes the user name has to be submitted in order to access a database on the server containing a list of user names. The best you can do with JavaScript is to set a cookie containing the user's name and then match it but of course the user can disable or delete this.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


    • #3
      To connect to the server to check whether the username is available requires adding Ajax code to the javascript that calls a server side script that does the checking.
      Learn Modern JavaScript - http://javascriptexample.net/
      Helping others to solve their computer problem at http://www.felgall.com/

      Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.