我正在本地机器上使用Wampserver测试下面的代码,但点击提交后,我收到消息"您尚未提交表单!"
<body>
<!-- Start code for the form-->
<form method="post" name="myform" action="form.php">
<p>
<label for='name'>Enter Name: </label><br>
<input type="text" name="name">
</p>
<p>
<label for='email'>Enter Email Address:</label><br>
<input type="text" name="email">
</p>
<p>
<label for='message'>Enter Message:</label> <br>
<textarea name="message"></textarea>
</p>
<input type="submit" name='submit' value="submit">
</form>
</body>
<!--form.php-->
<?php
if (isset($_POST['submit']))
{
echo "you have not submitted the form!";
}
else
{
echo "you have successfully submitted the form!";
}
?>
将代码更改为以下
<?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!";
}
?>