Php 屈服总是错误的。显示错误:";您尚未提交表格&“;;我正在使用Wampserver在本地机器上测试以下代码

Php 屈服总是错误的。显示错误:";您尚未提交表格&“;;我正在使用Wampserver在本地机器上测试以下代码,php,html,Php,Html,我正在本地机器上使用Wampserver测试下面的代码,但单击“提交”后,我收到消息“您尚未提交表单!” 输入名称: 输入电子邮件地址: 输入消息: 将代码更改为以下内容 <?php if (isset($_POST['submit'])) { // if the form was submitted and the submit button was clicked echo "you have successfully submitted the for

我正在本地机器上使用Wampserver测试下面的代码,但单击“提交”后,我收到消息“您尚未提交表单!”



输入名称:

输入电子邮件地址:

输入消息:


将代码更改为以下内容

<?php

if (isset($_POST['submit']))
{
    // if the form was submitted and the submit button was clicked
    echo "you have successfully submitted the form!";
}
else 
{
    echo "you have not submitted the form!";
}

我想你的情况是相反的。将if代码放在else中,将else代码放在if中,然后重试。我希望您的if是向后的,提交仅在提交后设置。这是一个奇怪的条件内容,如前所述。。。LOL.如果用户已提交表单,则消息当然应该是
echo“您已成功提交表单!”。因为PHP识别了
$\u POST['submit']
。假设你不是在和我们开玩笑。。。
<?php

if (isset($_POST['submit']))
{
    // if the form was submitted and the submit button was clicked
    echo "you have successfully submitted the form!";
}
else 
{
    echo "you have not submitted the form!";
}