这有效..
<form name="form1" action="test.php" method="post">
table class="questiontable" border="0">
<tr><td><input type="submit" name="previous_question" id="previous_question" value="Previous Question"></td></tr>
</table>
</form>
<?php
echo $_POST["previous_question"] ;
?>
输出
Previous Question
但是这不起作用并给出空白输出。 (请等待并禁用按钮有效)
<form name="form1" action="test.php" method="post">
<table class="questiontable" border="0">
<tr><td><input type="submit" onclick="this.disabled=true; this.value='Please Wait...'; this.form.submit();" name="previous_question" id="previous_question" value="Previous Question"></td></tr>
</table>
</form>
<?php
echo $_POST["previous_question"] ;
?>
我需要请等待点击以防止用户点击两次。问题是完成后 POST 变量没有传递。我需要 POST 变量来检查按下了哪个提交按钮,因为我的表单有很多。
请指出我做错了什么。
谢谢。
最佳答案
试试这个:
function foo () {
getElementByName("previous_question").value("please wait...");
getElementByName("form1").submit();
getElementByName("previous_question").disabled = true;
}
然后使用您的onclick
调用此函数
关于javascript - 添加onclick javascript时html中的输入标签不发送POST变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47749199/