PHP Get Form Method Summary

Source: Internet
Author: User
Tags date array html form variables query reset
When PHP accepts information submitted through an HTML form, it saves the submitted data in a global array, and we can get the values by calling the system-specific array of automatic global variables. The common automatic global variables are as follows:
$_get
$_post
$_request

The most commonly used automatic global variables in obtaining form data are $_get and $_post, which obtain data submitted by the Get method and the data submitted through the POST method, respectively. For example, a text box form control called "Txtage", if submitted using the Get method, can be used with the
$_get["Txtage"] or $_get[' txtage ']
Gets the value that it commits.

The $_request automatic global variable contains all the data for GET, POST, cookie, and file, and if you don't care about the data source, you can use the

$_request["Txtage"] or $_request[' txtage ' to get the submitted data.


Here is a simple example of getting the submitted data:

 -->");   Echo ("Your name is:". $_post[' yourname ']); Output name Echo ("
");   Echo ("Your password is:". $_post[' passwd ']); Output Password echo ("
");   Echo ("Your query password question is:". $_post[' question ']); Query password question echo ("
");   Echo ("The answer to your query password is:". $_post[' Question2 ']); Query password answer echo ("
"); Echo ("Your date of birth is:". $_post[' Byear '). " Years. " $_post[' Bmonth ']. "Month". $_post[' Bday '].   "Day"); Date of birth echo ("
");   Echo ("Your gender is:". $_post[' gender ']); Gender Echo ("
"); Echo ("Your hobby is:
"   ); Love foreach ($_post[' hobby '] as $hobby) {echo ($hobby. "
"); } ? > The corresponding form code is as follows: <title>User Survey Form</title> Welcome to this website, please enter the following personal data first:
Account:
Name:
Password:
Confirm Password:
Query password problem:
--Please choose--What's my pet name?Who is my best friend?What's my favorite color?My favorite movie?My favorite movie star?My favorite song?What's my favorite food?What's my biggest hobby?
Query password Answer:
Date of birth: ". $i."   Years "; }?> ". $i."   Month "; }?> ". $i."   Day "; }?>
Gender: Man Woman
Please choose your hobby:
Dance
Tourism
Sing
Play





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.