Html Forms
This tutorial will help you to learn Html Forms and It is very easy to learn .You just follow my tutorial .Open your notepad and write code ,save it and see it in browser step by step.
Lets Start.
The HTML form is used for collection of user input; Then the user
input is sent to a server for
processing.
The <form> tag is used for creation
of an HTML form and the syntax is−
<form action = "url" method = "GET/Post">
form elements e.g; input, text area etc.
</form>
Example:
<!DOCTYPE html>
<html>
<body>
<h2>html forms</h2>
<form
action="/action_page.php">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name"
value="Ali Khan"><br>
<label for="Fname">Father Name:</label><br>
<input type="text" id="Fname" name="Fname"
value="Aslam Khan"><br><br>
<input type="submit" value="Send">
</form>
<p>When you click the
"Send" button, the form-data will be sent to a page called
"/action_page.php".</p>
</body>
</html>
Browser Result:
Note: Method
Itis used to upload data. These methods are GET and POST.
The <input>
Element
The <input>
element is used for form element.
The <input>
element is used to display in many ways,
depending on the type
attribute.
Some examples are:
Type |
Description |
<input
type="text"> |
shows a single-line text input field |
<input
type="radio"> |
shows a radio button (to select one of many choices) |
<input
type="checkbox"> |
shows a checkbox (to select zero or more of many
choices) |
<input
type="submit"> |
shows a submit button (to submit the form) |
<input
type="button"> |
shows a click-able button |
The
<label> Element
We use <label> tag in above example.
It is used to describes label for many form elements.
It is used for screen-reader users.
The for
attribute
of <label>
tag
must be equal to the id
attribute
of the <input>
tag
to bind them together.
I hope you like the post ,please don't hesitate to share my post to your friends. Thanks!!!
Comments
Post a Comment