Forms
HTML Forms
Forms let us build interactive Web pages that collect information from a user.There are different types of form objects that we can place on our form, including text fields, radio buttons, check boxes, menus (list boxes), and buttons. Basic form elements that are commonly supported by the major Web browsers include the following.
- <form>
- <input>
- <select>
- <textarea>
Form Processing Basics
When deciding which controls to use, consider the information that you want to collect, use the following progression of controls.
- Start by finding out whether you can collect pieces of information using check boxes and radio buttons, because they are the quickest and easiest methods of input for the user, requiring only a click of the mouse.
- Look for a place where you can use a list, which is also easy to use. But try to make the list as short as possible.
- Then use text fields to collect short text input.
- Finally, include text areas only if visitors need to give longer responses using their own words.
Tag/Attribute Description action="..." Specifies the file, usually a program on the HTTP server that will process the output from the
form method="..." Tells the browser how to send the data to the server, with either the POST or GET method. The end result is the same,
and the distinction is how the information is provided to the server, either through the URL or through a form object. The action = and
method = attributes depend on the server-side program that processes the form.The documentation that came with your form - processing script
or with your Web server hosting account will tell you what to use whether POST or GET is the value for the method attribute.
The POST method is almost always used because it instructs the browser to send the form entry results as part of the document header,
hiding the data being passed. The GET method is the default value for the method attribute, and is the method used if the method
attribute is not specified in the form's opening tag. The GET method appends the data to the end of a URL to pass the data to the server.
The GET method is much less secure, but using GET does have some advantages.
Form Controls
Controls are the things that we use to collect user data. They consist of text boxes, buttons, check boxes, and radio buttons, and we will use them to collect and display data.
- Radio buttons give visitors an opportunity to choose one, and only one, item
- Check boxes allow visitors to select one item, no items, or several items from a list.
- Select lists are lists from which the visitor can choose one or more items.
- Text fields are for short text input, such as names, search terms, or e-mail addresses.
No comments:
Post a Comment