How to Insert a Login or Register Option on My Web Page

By Meg North

A login page can be easily added with HTML coding.
i login2 image by dinostock from Fotolia.com

Adding a login option to your web page will give your website users the opportunity to create a username and password. Many websites have login pages, so users can get access to confidential or exclusive information. The following HTML coding will enable you to add a simple form to your website, which will direct the information to a MySQL database.

Create a database in your MySQL. This database will store the username and password for every visitor to your web site.

Locate the HTML coding for the web page where you wish to add the login information. This is usually the homepage, but could also be a separate web page.

Once you're in the HTML coding, choose the place where you'd like your login information to appear (usually at the top of the page). The login information must appear between the and tags for it to display.

Add the following HTML code to start the login form:

The "/bin/processmyform.php" coding refers to the location of the file which will process the username and password information. This file location is in your MySQL database, which was created. Once you have located the file, rename the "/bin/processmyform.php" coding so that the information will be directed. PHP is a processing computer language that will direct website visitors' information from your web page to the database, where you can access the information.

Directly underneath the previous code, add the following code for the username:

This is the part of the form where the visitor types in their name. You could substitute 'Login' or 'Register' in place of Username, if you prefer.

Add the following code for the password:

This is the part of the form where the visitor types in their password.

Add the following code for the submit button:

Substitute "Login" or "Register" or "Submit" for the button if you'd like.

Close your HTML coding with the tag.

For easy reference, check your coding against the following code:

Save your coding and look at it on your web page. Try typing a test username and password to make sure the form is working properly.

×