<form method="POST" action="http://mywebsite.com/adir">
Yes
<input type="radio" name="do" value="truedeletelist" CHECKED />
<input type="hidden" name="listname" value="listname" />
No
<input type="radio" name="do" value="backtoapp" />
<input type="submit" value="Submit" />
</form>
为什么当我提交此表单时,变量$ _POST [&#39; do&#39;]和$ _POST [&#39; listname&#39;]为空?
编辑:
这是一个完整的版本,它仍然不起作用:
<!DOCTYPE html>
<html>
<body>
<?
if(!isset($_POST['do'])) {
echo $_POST['listname'];
echo $_POST['do'];
}
elseif($_POST['do'] == "deletelist") {
echo "Are you sure you want to delete the list?";
?>
<form method="POST" action="http://mywebsite.com/app/test.php">
Yes
<input type="radio" name="do" value="truedeletelist" CHECKED />
<input type="hidden" name="listname" value="list name" />
No
<input type="radio" name="do" value="backtoapp" />
<input type="submit" value="Submit" />
</form>
<?
}
?>
</body>
</html>
我正在运行PHP 5.4
答案 0 :(得分:0)
我明白了。这是由Wordpress在根目录上编写的htaccess规则的问题。当我将表单操作切换为指向index.php而不仅仅是目录时,它就像一个魅力。
即。
<form action="http://mywebsite.com/app/index.php" method="post">
是我修改它的改变。