More about WEB PAGE
Anatomy of the <head>
Grouping content
- Understanding the need to group content
- Using the div Element
- Grouping content into lists
- Dealing with figures
Creating advanced tables
- Adding table headers cells
- Denoting the headings and the table body
- Creating irregular tables
- Applying borders to the table element
Form Handling
- The action attribute
- The method attribute
- Configuring the Data Encoding
- Controlling form completion
- Setting the name of the form
- Adding labels to a form
- Automatically focusing on an input element
- Disabling individual input elements
- Grouping form elements together
- Using the button element
Customizing the input element
- Using the input element for text input
- Setting values and using placeholders
- Using a data list
- Creating read-only and disabled text boxes
- Restrict data entry
Using input validation
The method attribute specifies which HTTP method will be used to send the form data to the server. The allowed values are get and post, which correspond to the HTTP GET and POST methods. The default used when you don’t apply the method attribute is get, which is unfortunate because most forms require HTTP POST. You can see that we have specified the post value for the form in the example, as follows:
<form method="post" action="http://titan:8080/form">
GET requests are for safe interactions, which means you can make the same request as many times as you want and there will be no side effects. POST requests are for unsafe interactions, where the act of submitting the data changes some kind of state. This is most commonly the case when dealing with web applications. These conventions are set by the World Wide Web Consortium (W3C). The rule of thumb is that GET requests should be used for all read-only information retrieval, while POST requests should be used for any operation that changes the application state. It is important to use the right kind of requests. If you are unsure, err on the side of caution and use the POST method.