Simple steps to create a login form

Posted by kumarjit in Software, The Internet, Web Design Tutorials

1 Star2 Stars (2 votes, average: 0.00 out of 5)

Simple steps to create a login form

Most websites require visitors to register themselves and login time and again to access user-specific content. This is a great tool way to interact with the visitors and provide meaningful service to the customers. However, the login system is extremely easy to implement if it is created by using PHP and MySQL. Here are some easy steps through which you can create the login system

Connect to the database

The first step is to connect to the database that has the login information such as the username, password, etc. The following codes help in connecting to a database

$connection = mysql_connect (hostname, username, password)

mysql_select_db(database name);

Store the user provided data

The data provided by the user must be stored in the form of variables so that it can be checked with the database

$username = $_POST[‘uname’];

$password = $_POST[‘password’];

Check the data with the database

These stored variables would be now checked with the existing database. If there is a single match, then the user exists, and would be redirected to his specific page

$result = mysql_query(“SELECT * FROM table name WHERE username==’$username’ AND password==’$password’”);



//redirect to user page




echo (“Invalid login credentials!”);


Thus, one can easily let valid users in their specific website area and refuse access to the unknown ones!

BounceWeb provides fast, and reliable PHP-MySQL hosting.

Be Sociable, Share!

Leave a Reply

You must be logged in to post a comment.