When PHP accepts information submitted through an HTML form, it saves the submitted data in a global array, and we can call the system-specific array of automatic global variables to get those values. The usual automatic global variables are as follows:
$_get
$_post
$_request
In getting form data, the most common automatic global variables are $_get and $_post, which obtain data submitted through the Get method and submitted via the POST method, respectively. For example, a text box form control called "Txtage", if submitted with the Get method, can be used
$_get["Txtage"] or $_get[' txtage ']
Gets the value it commits.
The $_request automatic global variable contains all get, POST, cookie, and file data, such as not concerned with the data source, can be used
$_request["Txtage"] or $_request[' txtage '] to get the submitted data.
Here's a simple example of getting the commit data:
Echo ("Your name is:". $_post[' yourname '); Output name Echo ("
Echo ("Your password is:".) $_post[' passwd '); The output password echo ("
Echo ("Your query password question is:".) $_post[' question '); Query password question echo ("
Echo ("Your query password answer 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 sex is:".) $_post[' gender '); Gender Echo ("
Echo ("Your hobby is:
" ); Hobby 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 information first:
Account:
Name:
Password:
Confirm Password:
Query Password question:
--Please choose--My pet's name?Who is my best friend?My favorite color?My favorite movie?My favorite movie star?My favorite song?My favorite food?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
http://www.bkjia.com/PHPjc/820632.html www.bkjia.com true http://www.bkjia.com/PHPjc/820632.html techarticle when PHP accepts information submitted through an HTML form, it saves the submitted data in a global array, and we can call the system-specific array of automatic global variables to get these. Commonly used automatic ...