gpt4 book ai didi

php - HTML 表单未提交

转载 作者:太空宇宙 更新时间:2023-11-04 14:21:10 25 4
gpt4 key购买 nike

我在 index.php 中只有一个基本的 html 表单,其中包含两个文本字段:

<form action="index.php" method="post">
<label for="title">Title:</label> <input type="text" size="30" name="title"/><br>
<label for="number">Number:</label> <input type="text" size="30" name="number"/><br>
<input type="submit" class="submit" name="add" value="Add"/>
</form>

然后我有一些 PHP 脚本来检查表单是否已提交,如果已提交,它会运行一些脚本,但是这个脚本永远不会运行。

if($_POST['add'] == "Submit")
{
echo "This should print but it doesn't";
}

知道为什么这不起作用吗?谢谢。

最佳答案

代替:

if($_POST['add'] == "Submit")

做:

if($_POST['add'] == "Add")

关于php - HTML 表单未提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11253866/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com