- 1). Create a database in your MySQL. This database will store the username and password for every visitor to your web site.
- 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.
- 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 <body> and </body> tags for it to display.
- 4). Add the following HTML code to start the login form:
<form action="/bin/processmyform.php" method="post"
enctype="multipart/form-data">
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. - 5). Directly underneath the previous code, add the following code for the username:
<label>Username:</label>
<input type="text" value="" />
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. - 6). Add the following code for the password:
<label>Password:</label>
<input type="password" value="" />
This is the part of the form where the visitor types in their password. - 7). Add the following code for the submit button:
<input type="submit" value="Submit" />
Substitute "Login" or "Register" or "Submit" for the button if you'd like. - 8). Close your HTML coding with the </form> tag.
- 9). For easy reference, check your coding against the following code:
<form action="/bin/processmyform.php" method="post" enctype="multipart/form-data">
<label>Username:</label>
<input type="text" value="" />
<label>Password:</label>
<input type="password" value="" />
<input type="submit" value="Submit" />
</form> - 10
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.
SHARE