您好,我的电子邮件代码运行良好。我想要的是,当我按下发送按钮时,消息应该出现 MAIL END 并且所有表单都应该关闭......
输入您的电子邮件地址表单应该关闭,并且在同一页面上,邮件将显示为 MAIL SENT。而不会在任何其他页面上重定向。
<?php
if(isset($_POST['btnsubmit'])) {
$to = ($_POST['referrer_email']);
$from = "abcz@gmail.com";
$subject = "Hello";
$message = "abcasdfasdfa asdfasdf ";
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";
$headers .= "From: $from\r\n";mail($to, $subject, $message, $headers);
}
?>
<body>
<form name="ReferFriendForm" id="ReferFriendForm" method="post" action="" onSubmit="return validateForm()">
<table class="forms" width="100%" border="0" style="margin: 0px; padding: 0px">
<tbody style="margin: 0px; padding: 0px">
<tr style="margin: 0px; padding: 0px">
<td colspan="2" style="margin: 0px; padding: 0px">Pass the
Tel your friends and family about Net Telephone product and
service<br style="margin: 0px; padding: 0px">
</td>
</tr>
<tr style="margin: 0px; padding: 0px">
<td class="requiredLabel" style="width: 44%; vertical-align: top; text-align: center; font-weight: bold; margin: 0px; padding-left: 0px; padding-right: 20px; padding-top: 3px; padding-bottom: 3px">
Your Name:</td>
<td class="field" style="vertical-align: top; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 3px; padding-bottom: 3px" width="54%" align="center">
<input size="35" name="referrer_name" id = "referrer_name"style="float: left; margin: 0px; padding: 0px"></td>
</tr>
<tr style="margin: 0px; padding: 0px">
<td class="requiredLabel" style="width: 44%; vertical-align: top; text-align: center; font-weight: bold; margin: 0px; padding-left: 0px; padding-right: 20px; padding-top: 3px; padding-bottom: 3px">
Your Email:</td>
<td class="field" style="vertical-align: top; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 3px; padding-bottom: 3px" width="54%" align="center">
<input size="35" name="referrer_email" style="float: left; margin: 0px; padding: 0px"> </td>
</tr>
<tr style="margin: 0px; padding: 0px">
<td class="requiredLabel" style="width: 44%; vertical-align: top; text-align: center; font-weight: bold; margin: 0px; padding-left: 0px; padding-right: 20px; padding-top: 3px; padding-bottom: 3px">
Friend 1 Email:</td>
<td class="field" style="vertical-align: top; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 3px; padding-bottom: 3px" width="54%" align="center">
<input size="35" name="f1email" style="float: left; margin: 0px; padding: 0px">
<tr style="margin: 0px; padding: 0px">
<td class="requiredLabel" style="width: 44%; vertical-align: top; text-align: center; font-weight: bold; margin: 0px; padding-left: 0px; padding-right: 20px; padding-top: 3px; padding-bottom: 3px">
Friend 2 Email:</td>
<td class="field" style="vertical-align: top; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 3px; padding-bottom: 3px" width="54%" align="center">
<input size="35" name="f2email" style="float: left; margin: 0px; padding: 0px">
<tr style="margin: 0px; padding: 0px">
<td class="requiredLabel" style="width: 44%; vertical-align: top; text-align: center; font-weight: bold; margin: 0px; padding-left: 0px; padding-right: 20px; padding-top: 3px; padding-bottom: 3px">
Friend 3 Email:</td>
<td class="field" style="vertical-align: top; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 3px; padding-bottom: 3px" width="54%" align="center">
<input size="35" name="f3email" style="float: left; margin: 0px; padding: 0px">
<tr style="margin: 0px; padding: 0px">
<td class="requiredLabel" style="width: 44%; vertical-align: top; text-align: center; font-weight: bold; margin: 0px; padding-left: 0px; padding-right: 20px; padding-top: 3px; padding-bottom: 3px">
Friend 4 Email:</td>
<td class="field" style="vertical-align: top; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 3px; padding-bottom: 3px" width="54%" align="center">
<input size="35" name="f4email" style="float: left; margin: 0px; padding: 0px">
<tr style="margin: 0px; padding: 0px">
<td class="requiredLabel" style="width: 44%; vertical-align: top; text-align: center; font-weight: bold; margin: 0px; padding-left: 0px; padding-right: 20px; padding-top: 3px; padding-bottom: 3px">
Friend 5 Email:</td>
<td class="field" style="vertical-align: top; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 3px; padding-bottom: 3px" width="54%" align="center">
<input size="35" name="f5email" style="float: left; margin: 0px; padding: 0px">
</td>
</tr>
<tr style="margin: 0px; padding: 0px">
<td style="margin: 0px; padding: 0px" align="center"> </td>
<td style="margin: 0px; padding: 0px" width="54%" align="center">
<br style="margin: 0px; padding: 0px">
<input type="submit" name="btnsubmit" id="btnsubmit" value=" Send email " style="float: left; margin: 0px; padding: 0px"></td>
</tr>
</table>
</form>
</div>
</body>
</html>