x

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

by Meg North

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.

Step 1

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

Step 2

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.

Step 3

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.

Step 4

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.

Step 5

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.

Step 6

Add the following code for the password: This is the part of the form where the visitor types in their password.

Step 7

Add the following code for the submit button: Substitute "Login" or "Register" or "Submit" for the button if you'd like.

Step 8

Close your HTML coding with the tag.

Step 9

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.

Tip

  • Spend time learning about MySQL and PHP before you attempt to add login information.

Items you will need

  • MySQL
  • HTML text editor

Video of the Day

Brought to you by Techwalla
Brought to you by Techwalla

More Articles