<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<body>
<form action="12321.php" method="get">
名字: <input type="text" name="fname"><br/>
年龄: <input type="text" name="age"><br/>
<input type="submit" value="提交" name="submit">
</form><br/>
<?php
$a=$_GET["fname"];
$b=$_GET["age"];
$c=$_POST[submit];
var_dump($c);
echo "</br>";
if(isset($c)){
echo "欢迎".$a."</br>";
echo "年龄".$b."</br>";
}else
{
echo "欢迎光临";
}
?>
</body>
</html>
此文件的文件名是 12321.php
报错如下:
Notice: Undefined index: fname in F:\php\www\12321.php on line 18
Notice: Undefined index: age in F:\php\www\12321.php on line 19
Notice: Use of undefined constant submit - assumed 'submit' in F:\php\www\12321.php on line 20
Notice: Undefined index: submit in F:\php\www\12321.php on line 20
日志里面也不会记录错误,页面里面也不会报错
谢谢你们的帮助,$_POST改成$_REQUEST和$_GET, $c=$_REQUEST[“submit”];还是会提示一下错误
otice: Undefined index: fname in F:\php\www\12321.php on line 18
Notice: Undefined index: age in F:\php\www\12321.php on line 19
Notice: Undefined index: submit in F:\php\www\12321.php on line 20
错误的这几行内容
$a=$_GET["fname"];
$b=$_GET["age"];
$c=$_REQUEST[“submit”];