我希望有人能幫助我與我的聯繫方式(HTML & PHP)。收到的電子郵件中沒有發現「公司名稱」字段。所有其他領域的工作很好。HTML/PHP聯繫表毛刺
這裏是我的HTML表單代碼:
<form action="contact.php" method="post">
Company Name<br>
<input type="text" name="cf_company" size="60">
<span class="contact"><img src="images/AIS Logo New.png" alt="AIS logo" width="325" height="170" hspace="25" align="right" class="contactimage"></span><br><br>
Contact Name<br>
<input type="text" name="cf_name" size="60">
<br><br>
Email<br>
<input type="text" name="cf_email" size="60">
<br><br>
Phone Number<br>
<input type="text" name="cf_phone" size="60">
<br><br>
State<br>
<input type="text" name="cf_state" size="60">
<br><br>
Sic Code<br>
<input type="text" name="cf_sic" size="60">
<br><br>
Total # of Employees<br>
<input type="text" name="cf_employees" size="60">
<span class="contact"><img src="images/People_image.jpg" alt="AIS logo" width="274" height="177" hspace="25" align="right" class="contactimage"></span><br><br>
Current Carrier<br>
<input type="text" name="cf_carrier" size="60">
<br><br>
Present Experience Mod<br>
<input type="text" name="cf_experience" size="60"><br><br>
Are you presently in the Assigned Risk Pool?<br>
<input name="cf_pool" type="text" size="60">
<br><br>
Comments/Additional Information<br>
<textarea name="cf_message" cols="75" rows="8"></textarea><br><br><br>
<center><input type="submit" value="Send">
<input type="reset" value="Clear">
這裏是我的PHP代碼:
<?php
$field_company = $_POST['cf_company'];
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_phone = $_POST['cf_phone'];
$field_state = $_POST['cf_state'];
$field_sic = $_POST['cf_sic'];
$field_employees = $_POST['cf_employees'];
$field_carrier = $_POST['cf_carrier'];
$field_experience = $_POST['cf_experience'];
$field_pool = $_POST['cf_pool'];
$field_message = $_POST['cf_message'];
$mail_to = '[email protected]';
$subject = 'Message from a site visitor '.$field_name;
$body_message = 'From: '.$field_company."\n";
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Phone: '.$field_phone."\n";
$body_message .= 'State: '.$field_state."\n";
$body_message .= 'Sic: '.$field_sic."\n";
$body_message .= 'Employees: '.$field_employees."\n";
$body_message .= 'Carrier: '.$field_carrier."\n";
$body_message .= 'Experience: '.$field_experience."\n";
$body_message .= 'Pool: '.$field_pool."\n";
$body_message .= 'Message: '.$field_message;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'contact.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to [email protected]');
window.location = 'contact.html';
</script>
<?php
}
?>
* *以下是電子郵件反饋我收到(減去公司名稱信息)
來源:金佰利 電子郵件:[email protected] 電話:909-XXX-XXXX 州:CA 耍寶:45677名 員工:35 載體:無 經驗:無 池:無 消息:測試
非常感謝您 - 我知道我可以從知道他們在做什麼的人那裏找到答案!謝謝你們兩位的答覆 - 這奏效了! :) – Kimberly