HTML Form Tag

If you want to make your website interactive or collect user's responses and inputs, you need to use <form> tag. HTML form tag <form> and </form> is used to create a form on the web page.

JavaScript, CGI or PHP is used to write scripts for making form interactive in order to collect inputs from the users, maintain user inputs data received through your web page.

You can place the form tag anywhere inside the Body of an HTML document. Text boxes, Radio buttons, Check boxes, Drop down list and Other input fields are used to create a form.

Basic attributes to a form are Action, Method and Enctype. Action attribute refers to the URL to which the form submission is sent which is usually be a server side script written in PHP or Pearl. Method attribute referes to the method of sending data to the Action URL. Method will be either "get" or "post". "Get" is suited for small forms and it is a default method whereas "Post" is used for comparatively larger forms. Enctype attribute refers to the format of the data submitted to the server.

Syntax

<form action="action_form.php" method="get" enctype="text/plain">
	form-associated elements will come here...
</form>

Example

<!DOCTYPE html>
<html>
<head>
<title>My HTML Form Example</title>
</head>
<body>
<form action="mailto:your email" method="get" enctype="text/plain">
      <p>
        Name: <input type="text" id="name" size="25"/>
     </p>
      <p>
        Please rate hotel service from 1 to 3 (1 = worst and 3= excellent): <br />
       <select id="service rating"><br />
          <option>1</option>
          <option>2</option>
          <option selected>3</option>
       </select>
      </p>
     </form>
</body>
</html>

This will produce following result

Name:

Please rate hotel service from 1 to 3 (1 = worst and 3= excellent):

See Also

HTML Form Tags
HTML Page Formating Tags
HTML Other Tags


 
 
SHARE THIS IF YOU LIKE!
submit to reddit

SUBSCRIBE FOR LATEST UPDATES
HAVE WE CONNECTED ON FACEBOOK?
TOP TUTORIALSTOP CODE EXAMPLESTOP LIVE DEMOLINKSSTAY CONNECTED
HTML Tutorial
HTML5 Tutorial
Bootstrap3 Tutorial
Javascript Tutorial
TypeScript Tutorial
AngularJS Tutorial
CSharp Tutorial
PHP Tutorial
Developer Tools
Javascript
AngularJS
Google MAP API V3
ASP.NET
Javascript
AngularJS
Google MAP API V3
Contact Us
Advertise with Us
Privacy Policy
Disclaimer
Stay connected. We actually like you. If you want to get up to the minute updates, then connect with us on your fav below.
 
Twitter   Linkedin   Facebook   Google+    RSS   Pinterest
 
Protected by Copyscape Original Content Checker
 
 
Copyright ©2017 www.techstrikers.com Unauthorized reproduction/replication of any part of this site is prohibited.