PHP $_get[] Usage _php Tutorial

Source: Internet
Author: User
PHP Tutorial $_get to get the data of the form that must be method=get, otherwise it will not be able to get the value Oh,

The $_get variable is an array of variable names and values that are sent by the HTTP GET method.

The $_get variable is used to collect values from the form method= "GET". Information sent from a form with a GET method is visible to anyone (displayed in the browser's address bar) and has a limit (up to 100 characters) to the amount of messages sent.


See an instance of getting form data



Properly determining which submission button is clicked in PHP:

if (Isset ($_get[' submit_one_x ')) {

} elseif (Isset ($_get[' submit_two_x ')) {
} else {

}
?>

Example Two

if ($_get[' time ']+300 >= time ()) {
echo "You took too long!
";
Exit
}
?>

Operation Select Value

ABCD


The PHP code to access which value (s) were selected:

foreach ($_get[' Myselect ') as $val) {
echo "You selected: $val
";
}
echo "You selected". Count ($_get[' Myselect ']). " Values. ";
?>

Get the data re-output of the form submission, which is also a complete example



A Simple HTML Form







index.php



Print "Welcome ". $_get [' User ']. "
nn ";
Print "Your address is:
" . $_get [' Address ']. "";
?>


Note: When using the $_get variable, all variable names and values are displayed in the URL. Therefore, this method should not be used when sending passwords or other sensitive information. However, because the variable is displayed in the URL, you can bookmark the page in the Favorites folder. In some cases, this is useful.

Note: The HTTP GET method is not suitable for large variable values; The value is not more than 100 characters

http://www.bkjia.com/PHPjc/631338.html www.bkjia.com true http://www.bkjia.com/PHPjc/631338.html techarticle PHP Tutorial $_get to get the data of the form that must be method=get, otherwise it will not be able to get the value Oh, the $_get variable is an array, the content is a variable sent by the HTTP GET method ...

  • Related Article

    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.