need php code for checkbox html form

inevizback

New Member
*** EDIT ******I HAVE GOT IT WORKING. Now I just help with one simple minor thing: How do I get the email to separate each checkbox selection with a Comma? So instaed of: Interested In: Hourly Sales Lead Generation B2B Sales It should read:Interested In: Hourly Sales Lead Generation, B2B Sales Thanks,NathanI just signed up on this site hoping to get some help making my form to send the checkbox selections with the email.I'm pretty much a noob with php stuff, but using a lynda.com I got my contact form at least working - now I just need to get the checkbox selections to send with the email.Here is my form:\[code\]<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="http://stackoverflow.com/questions/13728142/Pay For Performance Appointment Setting" class="checkbox" id="option1" /> Pay For Performance Appointment Setting <br /> <input type="checkbox" name="interested[]" value="http://stackoverflow.com/questions/13728142/Hourly Sales Lead Generation" class="checkbox" id="option2" /> Hourly Sales Lead Generation <br /> <input type="checkbox" name="interested[]" value="http://stackoverflow.com/questions/13728142/B2B Sales" class="checkbox" id="option3" /> B2B Sales <br /> <input type="checkbox" name="interested[]" value="http://stackoverflow.com/questions/13728142/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="http://stackoverflow.com/questions/13728142/images/send-big.jpg" alt="" /> </div> </form>\[/code\]-and here is my php-\[code\]<?php/* Subject and Email Variables */$emailSubject = $_POST['subject'];$webMaster = '[email protected]';$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="http://stackoverflow.com/questions/13728142/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="http://stackoverflow.com/questions/13728142/css/basic-jquery-slider.css" /> </head> <body> <!-- header --> <div id="pageArea"> <div id="headerArea"> <div id="header"> <div class="content"> <a id="logo" href="http://stackoverflow.com/questions/13728142/index.html" title="Home"><img src="http://stackoverflow.com/questions/13728142/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="http://stackoverflow.com/questions/13728142/index.html" title="Home"></a></div> <div> | </div> <div id="about"><a href="http://stackoverflow.com/questions/13728142/about.html" title="About Us"></a></div> <div> | </div> <div id="services"><a href="http://stackoverflow.com/questions/13728142/services.html" title="Services"></a></div> <div> | </div> <div id="faq"><a href="http://stackoverflow.com/questions/13728142/faq.html" title="FAQ"></a></div> <div> | </div> <div id="rep"><a href="http://stackoverflow.com/questions/13728142/rep.html" title="Become a Rep"></a></div> <div> | </div> <div id="contact"><a href="http://stackoverflow.com/questions/13728142/contact.html" title="Contact Us"><img src="http://stackoverflow.com/questions/13728142/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="http://stackoverflow.com/questions/13728142/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="http://stackoverflow.com/questions/13728142/index.html" title="Home">Click To Go Back!</a> </div> </div> </div> <div class="clearer"></div> </div> </body></html>EOD;echo "$theResults";?>\[/code\]I appreciate any help :)Thanks for reading.-Nathan
 
Back
Top