PHP get form Summary of steps

Source: Internet
Author: User

php Get Form method Summary
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:

<?php echo ("Your account number is:". $_post[' login ');  //Output account echo ("<br>");

Echo ("Your name is:". $_post[' Yourname ']);  //Output name Echo ("<br>");

Echo ("Your password is:". $_post[' passwd ']  );  //Output password echo ("<br>");

Echo ("Your query password question is:". $_post[' question ']  );  //Query password question echo ("<br>");

Echo ("The answer to your query password is:". $_post[' Question2 ']   );  //Query password answer echo ("<br>"); Echo ("Your date of birth is:". $_post[' Byear '). " Years. " $_post[' Bmonth ']. "Month". $_post[' Bday '].


"Day"    );  //Date of birth echo ("<br>");


Echo ("Your gender is:". $_post[' gender ']);  //Gender echo ("<br>"); Echo ("Your hobby is:<br>"   );  //Hobby foreach ($_post[' hobby '] as $hobby)  {   Echo ($ Hobby.
"<br>");

?>    The corresponding form code is as follows: <html> <head> <title> User Survey table </title> </head> <body> Welcome to this website, please enter the following personal data first:<br> <form method=post action= "BaidU.php "> account: <input maxlength=25 size=16 name=login><br> name: <input type=password size=19 Name=yourname ><br> Password: <input type=password size=19 name=passwd ><br> Confirm password: <input type=password size=19 name= passwd ><br> Query Password problem:<br> <select name=question> <option selected value= "" >--Please choose--</ option> <option value= "My pet name?" "> My pet name?" </option> <option value= "Who is my best friend?" "> Who is my best friend?" </option> <option value= "My favorite color?" "> My favorite color?" </option> <option value= "My favorite movie?" "> My favorite movie?" </option> <option value= "My favorite movie star?" "> My favorite movie star?" </option> <option value= "My favorite song?" "> My favorite song?" </option> <option value= "My favorite food?" "> My favorite food?" </option> <option value= "My biggest hobby?" "> My greatest Hobby?" </option> </select> <br> Query password answer: <input name= "Question2" size= "><br>" date of birth:     <select name= "byear" id= "birthyear" tabindex=8>      <?php &nbsP; for ($i =1930 $i <=2009; $i + +) {  echo "<option value= ' $i ' >". $i. "
Year </option> ";  &NBSP}  ?>    </select>      <select name= "Bmonth" id= " Birthyear "tabindex=8>      <?php   for ($i =1; $i <=12; $i + +) {  echo" <option value= ' $i ' > '. $i. "
Month </option> ";  &NBSP}  ?>    </select>      <select name= "bday" id= "Birthyear" Tabindex=8>      <?php   for ($i =1; $i <=30; $i + +) {  echo "<option Value= ' $i ' > '. $i. "
Day </option> ";  &NBSP}  ?>    </select> <br> sex: <input type= "Radio" name= "Gender" value= "1" checked>        male        <input type= "Radio" name= "Gender" value= "2" >        female <br> Please choose your hobby:<br> <inpuT type= "checkbox" Name= "hobby[]" value= "Dance" > Dance <br> <input type= "checkbox" Name= "hobby[" value= "Tour" & gt; travel <br> <input type= "checkbox" Name= "hobby[]" value= "Sing" > Singing <br> <input type= "checkbox" Name= "hobby[]" value= "Dance" > Play <br> <input type= "Submit"    value= "submitted" > <input type= "Reset"    value= "re-fill" > <br> </body> <html>

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.