{ LearnWebSiteDesign.com }
HTML, HTML5, XHTML, CSS and CSS3 Tutorials
HTML Form Tutorials
An HTML form by itself does nothing. An HTML form by itself is simply a container for form elements. Form elements are HTML elements that allow users to enter information into the form. Some examples of HTML elements that allow the user to enter information are: text fields, textarea fields, drop-down menus, radio buttons, checkboxex, etc.
Video Tutorials:
View our video tutorials to learn how to create HTML forms, text-fields, password fields, submit buttons and textareas.
How To Create Forms
HTML forms are created with a starting <form> tag an ending </form> tag.
The <form> tag takes 2 main attributes: action and method.
<form> action Attribute
The value of the action attribute is the name and location of the script or application that the form data will be sent to when the user submits the information. The form data will be processed by the named script or application.
<form> method Attribute
The method attribute specifies how the form data is sent to the script or application. The method attribute has 2 possible values: post and get, with the post method being the most commonly used and recommended method.
An HTML form must contain HTML form elements for the form to be of any real use.
Form Text-Fields
A text-field, also called a text-box, allows users to enter a small amount of text into an input field. Text-fields are typically used for information such as email adresses or names.
To insert a text-field within a form you must include the <input> tag with a type attribute and the attribute must have a value of "text".
The name attribute must also be included within the <input> tag so that the script or application that will process the data has a way of identifying the data. To do this, include the name attribute within the <input> tag. The value of the name attribute will be whatever name you give that particular data.
The HTML code above creates the form below.
How To Specify the Size of a Text-Field
The size of a text-field can be specified by including the size attribute with a number value.
The HTML code above creates the form below.
How To Pre-Include Text within a Text-Field
To pre-include text within text-fields, include the value attribute with whatever text you want to be pre-included within the text-field.
The HTML code above creates the form below.
Form Password-Fields
Forms can include password-fields. A password-field is similar to a text-field, except that the data entered into a password-field is replaced by either asterisks or black colored circles.
To insert a password-field within a form you must include the <input> tag with a type attribute and the attribute must have a value of "password".
The name attribute must also be included within the <input> tag so that the script or application that will process the data has a way of identifying the data. To do this, include the name attribute within the <input> tag. The value of the name attribute will be whatever name you give that particular data.
The HTML code above creates the form below.
How To Specify the Size of a Password-Field
The size of a password-field can be specified by including the size attribute with a number value.
The HTML code above creates the form below.
Submit Buttons
A form must have a submit button in order for users to be able to submit the data that they have entered into the form. This is done by adding a submit button to the form.
To add a submit button to a form, include an <input> tag within the form and give the tag a type attribute with a value of "submit".
The HTML code above creates the form below.
How To Specify the Text on Submit Buttons
The default text that appears on a submit button depends on the web browser, for example, Internet Explorer and Firefox display the default text as "Submit Query" and Chrome displays the default text as "Submit".
To specify the text that you want to be displayed on submit buttons, include the value attribute and have the value of the attribute be whatever text that you want to be displayed.
The HTML code above creates the form below.
Reset Buttons
A reset button can be included in a form to allow the user to set all of the form fields back to their original values.
To include a reset button, use the <input> tag and include the type attribute with a value of reset.
The HTML code above creates the form below.
How To Specify the Text on a Reset Button
Firefox and Internet Explorer both use the text "Reset" as the default text. You can specify the text that is displayed on the reset button with the value attribute and have the value of the attribute be whatever text you want displayed on the reset button.
The HTML code above creates the form below.
Form Textareas
Forms can contain a textarea. A textarea is similar to a text-field, however, a textarea spans multiple rows and columns.
A textarea is defined by a starting <textarea> tag and an ending </textarea> tag.
The dimensions of a textarea is defined by the rows attribute and the cols (columns) attribute with the value of each attribute being a number.
The name attribute must also included within the openning <textarea> tag so that the script or application that will process the data has a way of identifying the data.
The HTML code above creates the form below.
Form Check-Boxes
Check-boxes allow users to select one or more options in a form. A check mark will appear next to each item that the user has selected.
To include check-boxes in a form, include a type attribute with a value of of checkbox within an <input> tag.
The HTML code above creates the form below.
How To Pre-Select Check-Boxes
You can have check-boxes pre-selected by including a checked attribute with a value of checked.
The HTML code above creates the form below.
Form Radio Buttons
Radio buttons allow the user to select only one of a small number of options.
To include check-boxes in a form, include a type attribute with a value of radio within an <input> tag.
The HTML code above creates the form below.
How To Pre-Select Radio Buttons
You can pre-select one radio button at a time by including the checked attribute with a value of checked to the <input> tag of the radio button that you choose to pre-select.
The HTML code above creates the form below.
How To Create Drop-down Menus
A drop-down menu gives allows your users to select one option from a list of options. The default (or pre-selected) option is shown with an arrow pointing down. When that arrow is clicked on, the list of options appears in a drop-down format.
Two sets of openning and closing tags are used to create a drop-down menu. The first set of tags are the openning <select> and closing </select> tags. Enclosed within the <select> tags are the openning <option> and closing </option> tags. Each selection will have its own set of <option> tags.
The openning <select> tag must contain the name attribute so that the script or application that will process the submitted data will be able to identify the information. Each individual openning <option> tag must contain a value attribute with a unique value so the script or application can know which of the options was selected.
The HTML code above creates the form below.
Tutorials
Templates
References
Sponsors
You can get your website online using Velnet, a leading UK web hosting provider. They provide free template and installation for WordPress blogs. Discuss webmaster related topics at Webmaster Serve, a Webmaster SEO forum
SouthernWebGroup.com provides high quality website design in Atlanta, GA as well as around the world.
Find low cost cheap website hosting and domain registration.
Browser our free no ads web hosting directory and find the free web hosting that's right for you and your budget.
Advertise your web design and web development related products and services here.
- Web Hosting UK
- Web Design Manchester
- Cheap Web Hosting
- free website hosting reviews
- ecommerce design
- Advertise
Recommended
Download free css web hosting templates that are easy to edit at FreeWebHostingTemplates.com.
Friends
- free web hosting templates
- free web hosting templates
- free web hosting reviews
- Web Development
- HD Wallpapers
- best web hosting providers
- Web Hosting Blog
- domain names
- iPage Host Reviews
- Reliable Bluehost Reviews
- Programming Forum
- Alojamento Web
- criar sites
- Free Facebook Banners
- Free No Ads Web Hosting Reviews
- Cheap Web Hosting Reviews
- Free Web Hosting Templates
- Free Premium Wordpress Themes
- Free Premium Wordpress Themes
- Free Joomla Template
- Free Wordpress Themes
- Best Android Apps
- Wordpress Themes Gallery
- Information technology courses
- Free PSD Files