Thursday, February 13, 2014

Learn how to make simple login form (front-end) using HTML and PHP programming languages

Hi friends today we will see about how to make simple log in form using PHP, where there is no database connectivity is present.

So before starting actual log in form coding, first of all open XAMPP Control Panel and start Apache.
*HTML file:

[Figure 1: HTML form of Authorized Person’s log in form]
  As shown in figure1, this is HTML coding which will create static page. Beside basic syntax of HTML, <form> tag is used to create a form. "action" at (line 5) will take input a php file which is to be processed, and "method" at (line 5) is used to see which type of method for transferring data is used in php file. On (line 7) one text box is taken with the help of <input> tag, type=”text” specifies that it is simple plain text box and name is used to take php file name for authorized user. On (line 9) <input> tag is used for creating a text box, type=”password” specifies that this text box is a password field and hence it doesn’t show characters and name is used to take php file name for password of authorized person. On (line 10) <input> tag is used for creating a button, type=”submit” is used to specify that it is a button and by "value" a text on button is printed.
[Figure 2: Static HTML page for above coding]
  Now we will make this static page as dynamic by using PHP and allow a valid user to sign in by providing username and password.
*PHP file:
[Figure 3: PHP file for authorized person’s log in page]
  At (line 2 and 3) variables are created which will be used for log in by authorized person. POST method at (line 4 and 5) is used for security purpose so that value to be send through browser will not be visible to user.
[Figure 4: Output for authorized person’s log in page as username and password are accepted]

If there is any query regarding this blog you can refer my previous blogs or comment below, so that we can learn something important.