【发布时间】:2014-10-09 21:14:29
【问题描述】:
单击提交按钮时我试图获取表单值,但是当我运行它时,出现以下错误:
Notice: Undefined variable: mail in C:\xampp\htdocs\mylearning\add_user.php on line 20
这是我的代码:
<html>
<head>
<title> I am learning </title>
</head>
<body>
<form name="new_user" method="post" action="add_user.php">
<input type="text" name="mail"/> <br />
<input type="text" name="name"/><br/>
<input type="submit" name="submitbtn" value="continue"/>
</form>
</body>
</html>
<?php
if(isset($_POST["submitbtn"]))
$mail = isset($_POST['mail']);
$name1 = isset($_POST['name']); echo "Returned value from the function : $name1"; echo "Returned value from the function : $mail";
?>
【问题讨论】:
-
add_user.php的第 20 行是什么? -
出现错误的行是什么
-
向输入类型添加值有帮助吗?比如
<input type="text" value="" >我怀疑$mail没有收到输入的值