提交php表单后收到两封电子邮件

提交php表单后收到两封电子邮件,php,html,forms,Php,Html,Forms,我在我的网站的联系页面上有联系表格。提交表格后,我收到了成功消息,但我收到的不是一封,而是两封类似的电子邮件。请帮助 下面是我的HTML代码在联系我们的形式 <form name="frm" id="frm" method="POST" action="mail.php"> <div class="row"> <div class="span04">

我在我的网站的联系页面上有联系表格。提交表格后,我收到了成功消息,但我收到的不是一封,而是两封类似的电子邮件。请帮助

下面是我的HTML代码在联系我们的形式

<form name="frm" id="frm" method="POST" action="mail.php">
                         <div class="row">
                            <div class="span04">
                                <h5>Send Us Message</h5>
                                <div class="contact margin_1line"><label>Company Name :</label>
    <input type="text" name="companyname" id="companyname" style="width:220px; float:right; height:30px;" class="validate[required,custom[alphaspace]] for_obj" />&nbsp;</div>
    <br />
   <div class="contact margin_1line"><label>Email ID :</label>
    <input type="text" name="email" id="email" style="width:220px; float:right; height:30px;" class="validate[required,custom[email]] for_obj" />&nbsp; </div>
    <br>
<div class="contact margin_1line"><label for="message">Contact Address :</label>
    <textarea name="address" id="address" class="validate[required] for_obj" rows="8" cols="10" style="width:220px; float:right;"></textarea>&nbsp;</div>
    <br /><br /><br />
<div class="contact" style="float:right;"><label>&nbsp;</label>
            <input type="reset" value="reset" class="butt custom_font" style="float:right;" />
            <input type="submit" value="Send" class="butt custom_font" style="margin-right:10px; float:right;" />
        </div>
                            </div><!-- /span6 -->

                            <div class="span04">
                                <h5>&nbsp;</h5>
                              <div class="contact margin_1line"><label>Contact Person :</label>
    <input type="text" name="contactperson" id="contactperson" style="width:210px; float:right; height:30px;" class="validate[required,custom[alphaspace]] for_obj" />&nbsp;</div>
    <br>
<div class="contact margin_1line"><label>Office No. :</label>
    <input type="text" name="phone" id="phone" class="validate[required,custom[universal_contact]] for_obj" style="width:210px; float:right; height:30px;" />&nbsp;</div>
    <br>
<div class="contact margin_1line"><label for="message">Services Interested :</label>
    <textarea name="interested" id="interested" class="validate[required] for_obj" rows="8" cols="10" style="width:210px; float:right;"></textarea>&nbsp;</div>
                            </div><!-- /span6 -->

                            <div class="span04">
                                <h5>&nbsp;</h5>
                              <div class="contact margin_1line"><label>Designation :</label>
    <input type="text" name="designation" id="designation" style="width:220px; float:right; height:30px;" class="validate[required,custom[alphaspace]] for_obj" />&nbsp;</div>
    <br>
    <div class="contact margin_1line"><label>Mobile :</label>
        <input type="text" name="mobile" id="mobile" class="validate[required,custom[universal_contact]] for_obj" style="width:220px; float:right; height:30px;" />&nbsp;</div>
        <br>
<div class="contact margin_1line"><label for="message">Other Remarks :</label>
    <textarea name="remarks" id="remarks" class="" rows="8" cols="10" style="width:220px; float:right;"></textarea>&nbsp;</div>
                            </div><!-- /span6 -->

                        </div><!-- /row -->
</form>

给我们发信息
公司名称:

电子邮件ID:
联络地址:


联系人:
办事处号码:
感兴趣的服务: 任命:
流动电话:
其他备注:
下面是我在mail.PHP文件中的PHP代码

<?php
$companyname = $_POST['companyname'];
$contactperson = $_POST['contactperson'];
$designation = $_POST['designation'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$mobile = $_POST['mobile'];
$address = $_POST['address'];
$interested = $_POST['interested'];
$remarks = $_POST['remarks'];
$formcontent="Company Name: $companyname \n Contact Person: $contactperson \n Designation: $designation \n Phone: $phone \n Mobile: $mobile \n Contact Address: $address \n Services Interested: $interested \n Other Remarks: $remarks";
$recipient = "demomail@abc.com";
$subject = "Enquiry from Website";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You! <br /> We will get in touch with you as soon as possible.";
?>

您尚未在邮件发送功能上使用任何循环(
for
while
)。因此,邮件不可能被发送两次


因此,您可能已经两次单击按钮,或者您可能添加了相同的收件人电子邮件地址,并用逗号分隔。

使用Captcha来防止这种情况。

我只添加了一个电子邮件地址&我只是单击按钮一次进行了检查,但得到的结果相同。