php教程中$_get要获取表单的数据那必须把METHOD=GET才行,否则就无法正常获取值哦,
$_GET 变量是一个数组,内容是由 HTTP GET 方法发送的变量名称和值。
$_GET 变量用于收集来自 method="get" 的表单中的值。从带有 GET 方法的表单发送的信息,对任何人都是可见的(会显示在浏览器的地址栏),并且对发送的信息量也有限制(最多 100 个字符)。
看个获取表单数据的实例
//Properly determining which submission button was clicked in PHP:if(isset($_GET['submit_one_x'])) {
} elseif(isset($_GET['submit_two_x'])) {
} else {}
?>
实例二
if($_GET['time']+300 >= time()) {
echo "You took too long!
";
exit;
}
?>
操作select值
//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.";
?>
获取表单提交的数据再输出,这也是个完整的实例
A Simple HTML Form
// index.php
print "Welcome " . $_GET ['user'] . "
nn";
print "Your address is:
" . $_GET ['address'] . "";
?>
注释:在使用 $_GET 变量时,所有的变量名和值都会显示在 URL 中。所以在发送密码或其他敏感信息时,不应该使用这个方法。不过,正因为变量显示在 URL 中,因此可以在收藏夹中收藏该页面。在某些情况下,这是很有用的。
注释:HTTP GET 方法不适合大型的变量值;值是不能超过 100 个字符的

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
