国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP development basic tutorial $_GET variable

1. $_GET variable

The predefined $_GET variable is used to collect values ??from the form with method="get".

The information sent from a form with the GET method is visible to everyone (will be displayed in the browser's address bar), and there is a limit on the amount of information sent.

Example: The code is as follows

<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
</head>
<body>
<!-- 新建一個帶有兩個輸入框和一個提交按鈕的表單 -->
<!-- action為提交的的那個頁面,method為提交方式,有$POST和$GET兩種 -->
<form action="" method="get">
名字: <input type="text" name="name">
<br/>
年齡: <input type="text" name="age">
<br/>
<input type="submit" value="提交">
</form>
<hr/>
 大家好,我是 <?php echo $_GET["name"]; ?>!<br>
今年 <?php echo $_GET["age"]; ?>  歲。
</body>
</html>

Enter your name and age, click to submit to the current page

Note: When copying to local testing, the address bar The information we entered has been added, the details are as follows

QQ截圖20161027110231.png

Note:

  • "?" is preceded by the file address

  • www.phpcourse.com is the virtual domain name I set up myself. If you are interested in how to set up the virtual domain name, you can search online

  • ?name=小方&age=27 is the information submitted by the get method, also called the query string. If you submit it a few times, you will be able to discover its patterns

2. When to use method="get"?

When using method="get" in an HTML form, all variable names and values ??will be displayed in the URL.

Note: Therefore, this method should not be used when sending passwords or other sensitive information!

However, because the variable appears in the URL, it is possible to bookmark the page. In some cases this is useful.

Note: The HTTP GET method is not suitable for large variable values. Its value cannot exceed 2000 characters.


Continuing Learning
||
<html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <!-- 新建一個帶有兩個輸入框和一個提交按鈕的表單 --> <!-- action為提交的的那個頁面,method為提交方式,有$POST和$GET兩種 --> <form action="" method="get"> 名字: <input type="text" name="name"> <br/> 年齡: <input type="text" name="age"> <br/> <input type="submit" value="提交"> </form> <hr/> 大家好,我是 <?php echo $_GET["name"]; ?>!<br> 今年 <?php echo $_GET["age"]; ?> 歲。 </body> </html>
submitReset Code