Php receiving form submission data example _ PHP Tutorial

Source: Internet
Author: User
Detailed description of the data submission instance in the php receiving form. In php, there are several forms to submit data. one is post and get. next I will introduce php beginners in detail how to use get and post to receive data submitted by forms, there are several forms to submit data in php. one is post and get. next I will introduce php beginners in detail using get, post is used to receive the data submitted by forms. For more information, see.

PHP $ _ GET and $ _ POST variables are used to obtain information in the form, such as user input information.

PHP4.1 (like) cancels the direct receipt of variables, and uses $ _ GET ['variable name'] to receive the variables passed from the link, use $ _ POST ['variable name'] to receive the variables submitted from the form. There are also $ _ FILES [], $ _ SERVER [], etc.


The following is an HTML file. This HTML contains an HTML Form, which is mainly used for users to enter their names.

The code is as follows:

The HTML display interface is as follows:

When you enter a name in the form text box of this HTML file, such as "Jacky", and then click the OK button, it will jump to get. php, as shown in get. php.

The source code of get. php is as follows:

The code is as follows:
.

Obtain the data of the form control by taking the name value of the form control.

For example, "username" is the name value of the text input box of the form control,

The code is as follows:

You can use $ _ GET ["username"] to obtain the data in the text input box.

The code is as follows:

Obtain HTML Form (HTML Form) single dataset (input type = "radio") data
You can obtain the value of the single-sheet signature by taking the name value of the single-sheet signature.

$ _ POST: get HTML form submission data

The following is an HTML file. This HTML contains an HTML Form, which is mainly used for users to input user names.

The code is as follows:

When You enter a name in the text box of the HTML Form, such as "Jacky", and then click OK, the page will jump to post. php. the output result is You are Jacky .. The source code of post. php is as follows:

The code is as follows:

You are .


Obtain the data of the form control by taking the name value of the form control.

For example, "username" is the name value of the text input box of the form control,

The code is as follows:

You can use $ _ POST ["username"] to obtain the data in the text input box.

The code is as follows:

$ _ REQUEST variable

The PHP $ _ REQUEST variable contains $ _ GET, $ _ POST, and $ _ COOKIE content.

The PHP $ _ REQUEST variable can be used to obtain the form data sent through the "GET" and "POST" methods.

Case

The code is as follows:

Welcome .

You are Years old

...

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.