【发布时间】:2013-11-30 04:08:23
【问题描述】:
我在我的页面上使用 php 邮件表单。它工作得很好,但是当发送电子邮件时,有关成功发布的消息会在新的空白页面中打开。我想要做的是直接在发送按钮下显示一些格式的消息。我的代码如下所示。
<form action="contact.php" method="POST" id="contactform_main2" style="font-size:14px">
<ol>
<li>
<label for="email">Email</label>
<input type="email" id="email" name="email" class="text" required />
</li>
....etc
<li class="buttons">
<input type="submit" name="imageField" value="Odoslať" class="send" style="cursor:pointer" />
</li>
</ol>
</form>
这是php
<?php
...geting data
if(
mail("dominik0109@gmail.com", $subject,
$sprava, "From:" . $email)){
echo "<strong>Sucessfully sent</strong>";}
else {
echo "Error";}
?>
您可以在my page 上看到它,填写任何内容以发布表格。 请问如何解决这个问题? 谢谢
【问题讨论】:
-
这意味着contact.php 不是您现在所在的页面。您应该将其更改为当前页面
-
您将表单提交到与您当前页面不同的页面
contact.php。将操作留空或只输入“?”它会提交到当前页面。