Forms are one of the most important means of implementing a Web site program with user interaction in addition to hyperlinks. She is a series of tags provided by HTML for interacting with the server side. This paper mainly from two aspects of simple narration.
Part One FORM element
Form elements are mainly divided into form tags and input tags, as well as textarea, select, and option tags.
The form tag includes action and method, which represent the address of the Web page to which the form data is passed and how to pass the data.
The input tag has many common properties. The main input is the definition of the properties of the various information and the selection.
The textarea, select, and option tags are the multi-line text box, the role of the drop-down list. The value of the selected option is passed to the server.
The second part Get method and post method
The Get method is to pass the data structure of the form through a URL parameter and make a GET request to the server. The Get method's forms and hyperlinks have the same effect, and you can pass URL parameters like a server. The difference is that the form provides an intuitive user interface that is more conducive to user creation and editing of data to be submitted.
The $_get variable is a predefined variable that PHP uses to get the URL parameter, and the type is an array, which can be manipulated like a normal set.
Post requests are mainly submitted by form, and PHP can fetch variables on the server side after submission. It is through the HTTP POST information has the browser sent to the server side, the data transfer process is not seen by the user. Server side can use $_post predefined variables to get passed data, and $_get, $_post is not subject to URL parameters, you can more flexibility to store and organize data.
The difference between the Get method and the Post method
In the transitive principle, the former is passed by the URL parameter, the latter through the HTTP post, the data is stored in the HTML table header submitted to the server. Therefore, the former uses a user-visible URL address, all data is visible to the user, and the latter is not visible during the pass, so the latter is more secure.
Another difference is that the Get method passes the data received by the browser address bar character volume constraints, the amount of data can not be too large, and the Post method passed the data is not the restriction, you can submit more complex data, such as the transmission of files. Therefore, the developer should choose the Post method to pass the form data as much as possible.
PHP form Processing