***编辑** * ***
我已经成功了。现在我只帮助一件简单的小事:如何让电子邮件用逗号分隔每个复选框选择?
所以代替:
感兴趣:每小时销售线索生成 B2B 销售
它应该是:
感兴趣:每小时销售线索生成,B2B 销售
谢谢,内森
我刚刚在这个网站上注册,希望能得到一些帮助,让我的表格可以通过电子邮件发送复选框选择。
我几乎是一个 php 的菜鸟,但使用 lynda.com 我的联系表格至少可以工作 - 现在我只需要选择复选框来发送电子邮件。
这是我的表格:
<form id="mainForm" method="post" name="contact" action="http://www.digicrest.com/sales/contactFormProcess.php">
<ul>
<li>Name<span>*</span> <br/>
<input class="form2" name="name" type="text" />
</li>
<li>Email Address<span>*</span> <br/>
<input class="form2" name="email" type="text" />
</li>
<li>Subject<span>*</span> <br/>
<input class="form2" name="subject" type="text" />
</li>
<li>Company<span>*</span> <br/>
<input class="form2" name="company" type="text" />
</li>
<li>Phone Number <br/>
<input class="form2" name="phone" type="text" />
</li>
<li id="checkboxes">
I'm Interested In:
<br />
<div><input type="checkbox" name="interested[]" value="Pay For Performance Appointment Setting" class="checkbox" id="option1" /> Pay For Performance Appointment Setting
<br />
<input type="checkbox" name="interested[]" value="Hourly Sales Lead Generation" class="checkbox" id="option2" /> Hourly Sales Lead Generation
<br />
<input type="checkbox" name="interested[]" value="B2B Sales" class="checkbox" id="option3" /> B2B Sales
<br />
<input type="checkbox" name="interested[]" value="Inbound Lead Generation" class="checkbox" id="option4" /> Inbound Lead Generation
</div>
</li>
<li><span class="clearLeft"></span></li>
<div class="clearLeft"></div>
<li>Comments / Details<span>*</span> <br/>
<textarea class="form2B" cols="20" rows="6" name="message"></textarea>
</li>
</ul>
<div id="formButtons2">
<input class="clear2" type="reset" value=""/>
<input class="submit" type="image" name="submit" src="images/send-big.jpg" alt="" />
</div>
</form>
- 这是我的 php-
<?php
/* Subject and Email Variables */
$emailSubject = $_POST['subject'];
$webMaster = 'info@digicrest.com';
$email = $_POST['email'];
/* Gathering Data Variables */
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$subjectField = $_POST['subject'];
$companyField = $_POST['company'];
$phone = $_POST['phone'];
$messageField = $_POST['message'];
$interestedField = implode(' ', $_POST['interested']);
$body = <<<EOD
<br><hr><br>
Name: $nameField <br>
Email: $emailField <br>
Subject: $subjectField <br>
Company: $companyField <br>
Phone: $phone <br>
Interested In: $interestedField <br>
Message: $messageField <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Results Rendered as HTML */
$theResults = <<<EOD
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome To Sales Source Lead Generation - B2B Solutions</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Oswald:400,700' rel='stylesheet' type='text/css' />
<link rel="stylesheet" href="css/basic-jquery-slider.css" />
</head>
<body>
<!-- header -->
<div id="pageArea">
<div id="headerArea">
<div id="header">
<div class="content">
<a id="logo" href="index.html" title="Home"><img src="images/logo.jpg" width="198" height="102" alt=""/></a>
<div id="phone">
Call us Toll Free: <span>1-888-557-4223</span> Ext 2
</div>
<div id="navbar">
<div id="home"><a href="index.html" title="Home"></a></div>
<div> | </div>
<div id="about"><a href="about.html" title="About Us"></a></div>
<div> | </div>
<div id="services"><a href="services.html" title="Services"></a></div>
<div> | </div>
<div id="faq"><a href="faq.html" title="FAQ"></a></div>
<div> | </div>
<div id="rep"><a href="rep.html" title="Become a Rep"></a></div>
<div> | </div>
<div id="contact"><a href="contact.html" title="Contact Us"><img src="images/contact-current.jpg" width="87" height="16" alt="" /></a></div>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<div id="barArea2">
<div class="content">
<div id="light"><img src="images/light.png" width="787" height="493" alt="" /></div>
<h1 class="pageTitle">Message Sent!</h1>
</div>
</div>
<div id="hr"></div>
<div class="contentArea">
<div class="content">
<div align="center">Thank you for your message! Your email will be answered as soon as possible!
<br />
<br />
<a href="index.html" title="Home">Click To Go Back!</a>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>
我很感激任何帮助:)
谢谢阅读。
-内森