Team LiB
Previous Section Next Section

Creating the Login Form

The HTML form will contain just two fields: username and password. Both are required.

  1. Open a new file in your text editor and type the following HTML:

    <HTML>
    <HEAD>
    <TITLE>Login</TITLE>
    </HEAD>
    <BODY>
    <H1>Login to Secret Area</H1>
    
  2. Begin your form. Assume that the method is POST and the action is a script called do_authuser.php:

    <FORM METHOD="POST" ACTION="do_authuser.php">
    
  3. Create an input field for the username with a text label:

    <P><STRONG>Username:</STRONG><BR>
    <INPUT TYPE="text" NAME="username" SIZE=25 MAXLENGTH=25></p>
    
  4. Create an input field for the password with a text label.

    <P><STRONG>Password:</STRONG><BR>
    <INPUT TYPE="password" NAME="password" SIZE=25 MAXLENGTH=25></p>
    
  5. Add a submit button, and then close your form and add some more HTML so that the document is valid:

    <P><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Login"></P>
    </FORM>
    </BODY>
    </HTML>
    
  6. Save the file with the name show_login.html, and place this file in the document root of your web server.

  7. Open your web browser and type http://127.0.0.1/show_login.html.

    Click To expand

You will see the login form, with text fields for the username and password as well as a submit button.

Next, you create the back-end script for the login form.


Team LiB
Previous Section Next Section