Php receiving form submission data example

Source: Internet
Author: User
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, friends who need to know

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, for more information, see.

PHP $ _ GET and $ _ POST variables are used to obtain information in the form. for example, the user input information PHP4.1 (as if) is canceled and directly receives the variable, instead, use $ _ GET ['variable name'] to receive the variables passed from the link and 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 input user names.

The instance code is as follows:

  1.  

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, the page will jump to get. php, as shown in get. php.

The source code of get. php is as follows:

The instance code is as follows:

  1. .

Take the name value of the form control to obtain the data of the form control. for example, "username" is the name value of the text input box of the form control.

The instance code is as follows:

  1.  

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

The instance code is as follows:

  1.  

Obtain the data of an HTML Form (HTML Form) single Partition (input type = "radio"), obtain the name value of a single partition of the Form, and obtain the value of a single partition of the Form. $ _ POST: obtain 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 instance code is as follows:

  1.  

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

The instance code is as follows:

  1. You are .

Take the name value of the form control to obtain the data of the form control. for example, "username" is the name value of the text input box of the form control,

The instance code is as follows:

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

The instance 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.

The instance code is as follows:

  1. Welcome .  
  2. 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.