Php checks whether the form is submitted

Source: Internet
Author: User
Tags html header php form
When submitting a form through submit, we usually care whether a large amount of data filled in the form is submitted to the background. Here we need to make a judgment, using php code to determine whether the form data is submitted in the following form: Php checks whether a form is submitted

When submitting a form through submit, we usually care whether a large amount of data filled in the form is submitted to the background. Here we need to make a judgment, using php code to determine whether the form data is submitted in the following form:

 

Description: isset -- checks whether variables are set. The return value can be in the following forms.

If the variable does not exist, FALSE is returned.

If the variable exists and its value is NULL, FALSE is returned.

If the variable exists and the value is not NULL, true is returned.

When multiple variables are checked at the same time, TRUE is returned only when each individual item meets the previous requirement. Otherwise, the result is FALSE.

Php form submission method GET and POST requests

The GET method puts data together with the requested URL address, and the browsing result is placed in the cache area. Since GET is transmitted after the URL, the data size transmitted is limited.

The data sent using POST is stored in the package separately and does not follow the URL address. Therefore, a large amount of data can be sent. However, each time the client sends a request to the server, the request is not stored in the cache zone. You can use $ _ POST [] to receive POST data. Data is not displayed in the URL.

The following describes the differences between the two submission methods:

1. GET is to GET data from the server, and POST is to send data to the server.

2. GET is to add the parameter data queue to the URL referred to by the ACTION attribute of the submission form. the values correspond to each field in the form one by one and can be seen in the URL. POST uses the http post mechanism to place fields in the form and their content in the html header and send them to the URL address referred to by the ACTION attribute. You cannot see this process.

3. for form data submitted in GET mode, the server uses $ _ GET ['name'] to obtain the value of the variable. for form data submitted in POST mode, the server uses $ _ POST ['name'] to obtain submitted data. of course, both can obtain form data through $ _ REQUEST ['name. For the form data submitted in the REQUEST method, the server uses $ _ REQUEST ['name'] to obtain the variable value, but this method is rarely used.

4. the data volume transmitted by GET is small and cannot exceed 2 kB. The amount of data transmitted by POST is large, which is generally not restricted by default. However, in theory, it is generally considered that the length cannot exceed KB.

5. Low GET security and high POST security.

6. GET form values can be obtained through _ GET. However, parameters set through the action url cannot be obtained,

AndIs the same, that is, in this case, the GET method will ignore the parameter list behind the action page. The POST form value can be obtained through _ POST, but the parameter set through the action url parameter cannot be obtained through _ POST. Action = test. php? Id = 1: This is the GET method for passing values. you can use $ _ REQUEST and $ _ GET to accept passing values, but you cannot use POST to GET the values, even if the form is submitted in POST mode. When submitting a form, if there are parameters in the action, it is recommended that you only use the POST form method to obtain the data in the form directly through POST. for parameters in the action, child workers GET the data.

We recommend that you use the GET method for data query, and use the POST method for data addition, modification, or deletion.
The request first reads get and then reads post. it also exists, that is, it overwrites the previous variable.

The above is the details of php determining whether to submit the form. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.