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.
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 theand tags for it to display.
Add the following HTML code to start the login form:
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.
- "PHP and MySQL for Dummies"; Janet Valade; 2009
- Spend time learning about MySQL and PHP before you attempt to add login information.
Meg North has written professionally since 2008 as an online copywriter for the Sturbridge Yankee Workshop. She also published a short story in "The Maine Scholar." North has a Bachelor of Arts in media writing from the University of Southern Maine.