我有一个联系表格,我把它放在一起,大部分都有效。有4个字段可以捕获数据,但有些字段不会发布。名称,电子邮件,主题,消息工作正常。电话,地址,服务日期和听到关于我们不发布。所以我的问题是我需要在sendmail函数中添加变量s。这是我的代码。任何投入将不胜感激!谢谢!
HTML
<div class="ten columns">
<div class="form-div" id="contact-wrap">
<div id="sucessmessage" class="form-row"> </div>
<form method="POST" id="ContactForm">
<div class="span5">
<label>Full Name:</label>
<input id="cname" type="text" name="fullname" value="" class="input" />
</div>
<div class="span5">
<label>Your Email:</label>
<input id="cemail" type="text" name="email" value="" class="input" />
</div>
<div class="span5">
<label>Phone Number:</label>
<input id="cphone" type="text" name="phone" value="" class="input" />
</div>
<div class="span5">
<label>Address:</label>
<input id="caddress" type="text" name="address" value="" class="input" />
</div>
<div class="span5">
<label>Subject:</label>
<input id="csubject" type="text" name="subject" value="" class="input" />
</div>
<div class="span5">
<label>Expected Service Date:</label>
<input id="cservicedate" type="date" name="servicedate" value="" class="input" />
</div>
<div class="span5">
<label>Office:</label>
<select name="seloffice" id="seloffice" style="height: 40px;" class="input">
<option value="">Select Office</option>
<option value="TEST1a@TEST.com">Mexia Office</option>
<option value="TEST2@TEST.com" >Ft.Worth Office</option>
</select>
</div>
<div class="span5">
<label>How Did You Hear About Us?</label>
<select name="hearaboutus" id"hearaboutus" style="height: 40px;" class="input">
<option value="">Choose One</option>
<option value="You Contaced Me">You Contacted Me</option>
<option value="Search Engine" >Search Engine</option>
<option value="Social Media" >Social Media</option>
<option value="Advertisement" >Advertisement</option>
<option value="Friend" >Friend</option>
<option value="Event" >Event</option>
<option value="Blog" >Blog</option>
<option value="Other" >Other</option>
</select>
</div>
<div class="span5">
<label>Message:</label>
<textarea id="cmsg" name="message" rows="5" cols="10"></textarea>
<br/>
<div class="butalign">
<input type="submit" value="Submit" name="submsg" class="but"/>
</div>
</div>
</form>
</div>
</div>
PHP
<?php
//echo "<pre>"; print_r($_POST); echo "<pre>"; die;
if(isset($_POST['fullname']))
{
$name=$_POST['fullname'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$address=$_POST['address'];
$subject=$_POST['subject'];
$servicedate=$_POST['servicedate'];
$seloffice=$_POST['seloffice'];
$hearaboutus=$_POST['hearaboutus'];
$msg=$_POST['message'];
$message = "<table border='0' cellpadding='5' cellspacing='1' bgcolor='#cccccc'>
<tr bgcolor='#ffffff'>
<td>Name</td>
<td>".$name."</td>
</tr>
<tr bgcolor='#ffffff'>
<td>Email</td>
<td>".$email."</td>
</tr>
<tr bgcolor='#ffffff'>
<td>Phone</td>
<td>".$phone."</td>
</tr>
<tr bgcolor='#ffffff'>
<td>Address</td>
<td>".$address."</td>
</tr>
<tr bgcolor='#ffffff'>
<td>Subject</td>
<td>".$subject."</td>
</tr>
<tr bgcolor='#ffffff'>
<td>Service Date</td>
<td>".$servicedate."</td>
</tr>
<tr bgcolor='#ffffff'>
<td>Hear About Us</td>
<td>".$hearaboutus."</td>
</tr>
<tr bgcolor='#ffffff'>
<td>Message</td>
<td valign='top'>".$msg."</td>
</tr>
</table>";
$subject = "Inquiry/Service Request. -".date("F j, Y");
//$to = "TEST@TEST.com";
//$Bcc = "TEST1h@TEST.com";
$from = "Contact Form";
//$to = "TESR@TEST.com";
//$Bcc = "TEST@TEST.com;
//$from = "TEST@TEST.com";
$to = $Bcc = $seloffice;
$headers = "From:" . $email."\n";
$headers .= "Bcc:" . $Bcc."\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$sendMail = mail($to,$subject,$message,$headers);
if($sendMail){
echo "Sucess";
} else {
echo "Fail";
}}
&GT;