How to create HTML-Forms
Learn how to use HTML form controls
In this article we are going to learn How to use basic html-form controls for creating different kinds of forms. For any websites It should have at least one or two forms in the site in order to communicate with the client and share information and views of the users, which helps them to take their business up one level. So If we come to the topic, html provides various graphical user-interface controls for creating forms which allows users to feed different kinds of data. Now we learn what those controls are and how to use them etc. In this tutorial we will create the various forms one by one which are more frequently used in websites.
1) login page
2) signup page using following html controls:
- Radio buttons: Radio buttons allow users to choose only one option among the group. ex: Gender
- Checkbox: Checkbox allows users to choose all options from the group. ex:Hobbies
- Combo box: Combo box also called it as drop down. It holds a list of values and allows user to use one or more from the provided list ex: country list,states list etc.,
- Text area: It is a multi line text control. It allows the user to enter a large amount of text.
3) linking login page and signup form.
4) Creating contact form.
5) Creating upload form
using file input controls
ex:upload a file
Login Form
login-form.html
<html>
<head> <title> e-Trainings Demo on Html forms </title> </head>
<body>
<h1> Login Form </h1>
<form name="f1" method="get" action="">
Enter Username:
<input name="user" id="username" ><br>
Enter Password:
<input type="password" name="password"><br>
<input type="submit" name="submit" value="Login"> <br>
<a href= "signup-form.html"> Signup Here </a>
</form>
</body>
</html>Preview:
Signup or Registration Form
signup-form.html
<html><head>
<title> e-Trainings Demo on Html forms </title>
</head>
<body>
<form action="" method="post" >
<center>
<h2>Signup Form</h2>
</center>
Username:
<input name="user" id="username" ><br>
Password:
<input type="password" name="password"><br>
Confirm Password:
<input type="password" name="cpassword"><br>
Gender:
<input type="radio" value="Male" name="gender" checked /> Male
<input type="radio" value="Female" name="gender" />Female<br><br>
Country:
<select name="country" >
<option>India</option>
<option>America</option>
<option>Briton</option>
<option>France</option>
</select>
<br><br>
Hobbies:<br>
<input type="checkbox" value="singing" name="hob[]" />singing<br>
<input type="checkbox" value="dancing" name="hob[]" />dancing<br>
<input type="checkbox" value="drawing" name="hob[]" />drawing<br>
<input type="checkbox" value="scating" name="hob[]" />scating<br><br>
Address:<br>
<textarea rows=5 cols=50 name="address" />
</textarea><br><br>
<input type="submit" value="Submit" name="submit" value="Signup" />
<input type="reset" value="Reset" name="reset" />
</form>
</body>
</html>Preview:
Contact Form
contact-form.html
<html>
<head>
<title> e-Trainings Demo on Html forms </title>
</head>
<body>
<h1> Contact Form </h1>
<form name="f1" method="get" action="">
Enter Name:
<input name="name" id="name" ><br>
Enter Email:
<input name="email" id="email" ><br>
Enter Phone:
<input type="phone" name="phone"><br>
<input type="submit" name="submit" value="Contact">
</form>
</body>
</html>Preview:
file-upload-form.html
<html> <head>
<title> e-Trainings Demo on Html forms </title>
</head>
<body>
<h1> FileUpload Form </h1>
<form name="f1" method="get" action="" enctype="multipart/form-data">
Choose File:
<input name="file" id="file" ><br>
<input type="submit" name="submit" value="Contact">
</form>
</body>
</html>
Preview:





Comments
Post a Comment