【发布时间】:2016-02-13 12:42:17
【问题描述】:
我不知道如何处理该错误。我只想将值传递到另一个页面。我使用“GET”方法,没关系。但是,它不适用于“POST”方法。
错误: 未定义索引:第 18 行 C:\Users\x\x\x\x\x 中的数据
Testing.html:
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<form method="POST" action="testing.php">
<input name="data" type="text">
<input type ="submit" value="send">
</form>
</body>
</html>
testing.php
<?php
$data = $_REQUEST["data"];
if (isset($data)) {
echo $data;
}
else
{
echo "No data ";
}
?>
【问题讨论】:
-
检查您是否将属性名称作为输入表单上的数据,如上所述。很容易不小心使用 id 而不是 name。