$_POST 或$_GET或 $_REQUEST接受表单值
来源:互联网 发布:网络摄像头有看头下载 编辑:程序博客网 时间:2024/06/07 00:59
//就这么个问题困扰我好久, 我用$_get, or $_post or $_request, 都接收不到表单传来的值
HTML代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1 align="center"><img src="u=3289850893,3856207640&fm=21&gp=0.jpg">
Certification<img src="u=3289850893,3856207640&fm=21&gp=0.jpg"></h1>
<p>You too can earn your highly respected PHP certification
from the world famous Fictional Institute of PHP Certification</p>
<p>Simply answer the questions below:</p>
<form action="score.php" method="post">
<p>Your Name <input type="text" name="name"></p>
<p>What does the PHP statement echo do?</p>
<ul>
<li><input type="radio" name="q1" value="1"> Outputs strings.</li>
<li><input type="radio" name="q1" value="2">Adds two numbers together.</li>
<li><input type="radio" name="q1" value="3">Creates a magical elf to finish writing your code</li>
</ul>
<p>What does the PHP function cos()do?</p>
<ul>
<li><input type="radio" name="q2" value="1">Calculates a cosine in radians.</li>
<li><input type="radio" name="q2" value="2">Calculates a tangent in radians.</li>
<li><input type="radio" name="q2" value="3">It is not a PHP function, It is a lettuce.</li>
</ul>
<P>What does the PHP function mail()do?</P>
<ul>
<li><input type="radio" name="q3" value="1">Sends a mail message.
<li><input type="radio" name="q3" value="2">Checks for new mail.
<li><input type="radio" name="q3" value="3">Toggle PHP between male and female mode.
</ul>
<p align="center"><input type="image" src="u=3919487505,3470538747&fm=15&gp=1.jpg" border="0"></p>
</form>
</body>
</html>
//php 代码
<?php
//create short variable names
$name=$_GET['name'];
var_dump($name); //返回都是 null,
$q1=$_GET['q1'];
$q2=$_GET['q2'];
$q3=$_REQUEST['q3'];
//check that all the data was received
if (($q1=='')||($q2=='')||($q3=='')||($name=='')){
echo "<h1><p align='center'>
<img src='u=3289850893,3856207640&fm=21&gp=0.jpg' alt=''>
Sorry:
<img src='u=3289850893,3856207640&fm=21&gp=0.jpg' alt=''>
</p></h1>
<p>You need to fill in your name and answer all questions.</p>";
//最终都是没有接受到,返回You need to fill in your name and answer all questions
0 0
- $_POST 或$_GET或 $_REQUEST接受表单值
- $_request与$_post、$_get用于接受表单数据,区别
- $_request与$_post、$_get用于接受表单数据的区别
- $_GET,$_post与$_REQUEST
- _REQUEST、$_POST、$_GET
- $_SERVER/$_REQUEST/$_POST/$_GET
- $_GET、$_POST和$_REQUEST变量
- php中的$_REQUEST、$_GET、$_POST
- PHP中,$_request 、$_post 、$_get的区别
- php中$_Get $_POST $_REQUEST区别
- php中$_REQUEST、$_POST、$_GET的区别
- PHP中的$_POST,$_GET,$_REQUEST的区别
- $_request、$_post、$_get的区别和特点
- PHP 里面$_REQUEST 包含 $_GET,$_POST,$_COOKIE
- PHP 表单和用户输入、PHP $_GET、PHP $_POST、$_REQUEST 变量
- php中$_request与$_post、$_get的区别
- php中$_request与$_post、$_get的区别
- PHP 中 $_REQUEST、$_GET、$_POST、$_COOKIE 的关系和区别
- 正版win7系统下载重装教程
- c++之巧用type_info
- 1324342312243546765433
- jQuery使用技巧
- 生命倒计时-倒数9119日
- $_POST 或$_GET或 $_REQUEST接受表单值
- shell的for循环
- scrapy定时任务
- Flex 弹性盒子布局使用教程
- Linux下文件查找指令which/whereis/locate/find
- 10个重要的Linux ps命令实战
- mapreduce 辅助类GenericOptionsParser,Tool和ToolRunner
- 每一个程序员需要了解的10个Linux命令
- mysql做简单用户登陆的几种方式