newatthis123 Posted October 21, 2014 Share Posted October 21, 2014 I've sent test to server and verified that email working. New with PHP so assuming my code is wrong. contact.html contact_script.php Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/ Share on other sites More sharing options...
ginerjm Posted October 21, 2014 Share Posted October 21, 2014 You didn't post any code. You didn't tell us what is wrong. Show us any error message you get and isolate your (soon to be) posted code to the area of the message and give us a chance to help you. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1494347 Share on other sites More sharing options...
newatthis123 Posted October 23, 2014 Author Share Posted October 23, 2014 I attached html file and php script on my first posting. Should I be doing something different? When I fill out form, hit submit button email does not come back to me. No errors, nothing. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1494465 Share on other sites More sharing options...
davidannis Posted October 23, 2014 Share Posted October 23, 2014 You should probably post the relevant sections of the code and html in the message so we don't have to download it. Use the <> button on the editor to get a box into which you can paste the code and have it formatted. I'm off to download your code. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1494466 Share on other sites More sharing options...
davidannis Posted October 23, 2014 Share Posted October 23, 2014 Put this at the TOP of your files so errors display: <?php ini_set("display_errors", "1"); error_reporting(-1); ?> Also, I noticed that you build your message after you send the mail: mail($to,$email_subject,$email_body,$headers); // build message $message = "Drake Centre Event Form.\n\n"; $message .= "name: $name\n\n"; $message .= "address: $address\n\n"; $message .= "phone_number: $phone_number\n\n"; $message .= "cell_number: $cell_number\n\n"; $message .= "email_address: $email_address\n\n"; $message .= "event_date: $event_date\n\n"; $message .= "event_time: $event_time\n\n"; $message .= "attendance: $attendance\n\n"; $message .= "banquet_room: $banquet_room\n\n"; $message .= "both_rooms: $both_rooms\n\n"; $message .= "bar_area: $bar_area\n\n"; $message .= "contact_name: $contact_name\n\n"; $message .= "phone_number: $phone_number\n\n"; $message .= "dvd: $dvd\n\n"; $message .= "questions: $questions\n\n"; and you send $email_body but build $message. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1494467 Share on other sites More sharing options...
newatthis123 Posted October 23, 2014 Author Share Posted October 23, 2014 Thanks, I did put that error reporting at top of script. So I should build message before sending email? I will change that. Please elaborate on your comment: send $email_body but build $message, not sure what that means? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Adobe GoLive" /> <link href="drake_d.ico" rel="shortcut icon" /> <title>Drake Centre Contact</title> <link href="css/basic.css" rel="stylesheet" type="text/css" media="all" /> <csscriptdict import="import"> <script type="text/javascript" src="GeneratedItems/CSScriptLib.js"></script> <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script> </csscriptdict> <csactiondict> <script type="text/javascript"><!-- var preloadFlag = false; function preloadImages() { if (document.images) { pre_home_ro = newImage('images/navigation/home_ro.gif'); pre_contact_ro = newImage('images/navigation/contact_ro.gif'); pre_location_ro = newImage('images/navigation/location_ro.gif'); pre_menu_ro = newImage('images/navigation/menu_ro.gif'); pre_accommodations_ro = newImage('images/navigation/accommodations_ro.gif'); preloadFlag = true; } } // --></script> </csactiondict> <csimport user="navigation_comp.html" occur="23"> <csactions> <csaction name="3dc7ce6f0" class="Goto Link" type="onevent" val0="accommodations.html" val1="" urlparams="1"></csaction> <csaction name="3dc819ef1" class="Goto Link" type="onevent" val0="menu.html" val1="" urlparams="1"></csaction> <csaction name="3dc8a3e02" class="Goto Link" type="onevent" val0="location.html" val1="" urlparams="1"></csaction> <csaction name="3dc934a63" class="Goto Link" type="onevent" val0="contact.html" val1="" urlparams="1"></csaction> <csaction name="5cef216b1" class="Goto Link" type="onevent" val0="index.html" val1="" urlparams="1"></csaction> </csactions> <csactiondict> <script type="text/javascript"><!-- CSAct[/*CMP*/ '3dc7ce6f0'] = new Array(CSGotoLink,/*URL*/ 'accommodations.html',''); CSAct[/*CMP*/ '3dc819ef1'] = new Array(CSGotoLink,/*URL*/ 'menu.html',''); CSAct[/*CMP*/ '3dc8a3e02'] = new Array(CSGotoLink,/*URL*/ 'location.html',''); CSAct[/*CMP*/ '3dc934a63'] = new Array(CSGotoLink,/*URL*/ 'contact.html',''); CSAct[/*CMP*/ '5cef216b1'] = new Array(CSGotoLink,/*URL*/ 'index.html',''); // --></script> </csactiondict> </csimport> <style type="text/css"> <!-- body { margin-top: 5px; } --> </style> <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /> <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> <link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- #apDiv1 { position:absolute; left:291px; top:254px; width:388px; height:14px; z-index:7; visibility: visible; } #apDiv1 strong { font-family: Arial, Helvetica, sans-serif; } #apDiv2 { position:absolute; width:242px; height:251px; z-index:6; left: 17px; top: 263px; } #apDiv2 { font-family: Arial, Helvetica, sans-serif; } #apDiv2 { font-size: 12px; } --> </style> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="MM_preloadImages('../images/navigation/home_h.gif','../images/navigation/accommodations_h.gif','../images/navigation/testimonials_h.gif','../images/navigation/location_h.gif','../images/navigation/contact_h.gif',)"> <div style="position:relative;width:740px;height:580px;background-color:#000;margin:auto;-adbe-g:p,5,5;"> <div style="position:absolute;top:1px;left:1px;width:738px;height:578px;"> <div style="position:relative;width:738px;height:578px;background-color:#fff;-adbe-g:p,5,5;"> <div style="position:absolute; top:4px; left:4px; width:730px; height:246px; visibility: visible;"> <div style="position:absolute;top:270px;left:20px;width:255px;height:150px;-adbe-c:c"> <div align="left"> <!--<font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Contact the Drake Centre today to set-up<br /> a personal tour and meeting.<br /> </font>--> </div> <div text-align="left"> <p style="margin-bottom:-12px;"><font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">802 West Drake Road</font></p> <p><font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Fort Collins, Colorado 80526</font></p> <p><font size="6" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">970.492.6473<br /></font></p> <a href="mailto:contact@drakecentre.com">contact@drakecentre.com</a> </div> </div> <div style="position:absolute;top:470px;left:15px;width:139px;height:50px;"> <a href="index.html"><img src="images/drake_centre_sm.gif" alt="" border="0" /></a></div> <!-- <div id="apDiv1"><strong>Request Form </strong></div> --> <div style="position:relative;width:730px;height:246px;background-color:#000;-adbe-g:p,5,5;"> <div style="position:absolute; top:80px; left:5px; width:140px; height:140px; z-index: 1;"> <img src="images/dance_floor.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:0px; left:7px; width:575px; height:80px; z-index: 2;"> <img src="images/contact.gif" alt="" height="80" border="0" /></div> <div style="position:absolute; top:80px; left:150px; width:140px; height:140px; z-index: 3;"> <img src="images/croud.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:80px; left:295px; width:140px; height:140px; z-index: 4;"><img src="images/exterior.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:80px; left:440px; width:140px; height:140px; z-index: 5;"><img src="images/interior.gif" alt="" height="140" width="140" border="0" /></div> </div> </div> <div style="position:absolute;top:531px;left:4px;width:730px;height:42px;"> <div style="position:relative;width:730px;height:42px;background-color:#000;-adbe-g:p,5,5;"><!-- #BeginLibraryItem "/Library/drake_navigation.lbi" --> <script type="text/javascript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <table border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td width="20"> </td> <td><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/navigation/home_h.gif',1)"><img src="images/navigation/home.gif" alt="Home" name="Home" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="accommodations.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Accommodations','','images/navigation/accommodations_h.gif',1)"><img src="images/navigation/accommodations.gif" alt="Accommodations" name="Accommodations" width="108" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="location.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Location','','images/navigation/location_h.gif',1)"><img src="images/navigation/location.gif" alt="Location" name="Location" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="contact.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Contact','','images/navigation/contact_h.gif',1)"><img src="images/navigation/contact.gif" alt="Contact" name="Contact" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/navigation_bar_01.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> </tr> </table> <!-- #EndLibraryItem --></div> </div> <div style="position:absolute; top:262px; left:284px; width:431px; height:90px; -adbe-c:c"> <form action="contact_script.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" >Contact Info</li> <li class="TabbedPanelsTab" >Event Into</li> <li class="TabbedPanelsTab" >Additional Info<br /> </li> <li class="TabbedPanelsTab" >Submit<br /> </li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"> <p><span id="sprytextfield2"> <label>Name <input name="Name" type="text" id="Name" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprytextfield3"> <label>Address <input name="Address" type="text" id="Address" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprytextfield4"> <label>Phone number <input name="Phone number" type="text" id="Phone number" size="15" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span class="textfieldInvalidFormatMsg">Invalid format.</span> <span id="sprytextfield5"> <label>Cell number <input name="Cell number" type="text" id="Cell number" size="15" /> </label> <span class="textfieldRequiredMsg">A value is required.</span> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p> <p><span id="sprytextfield6"> <label>Email address <input name="Email" type="text" id="Email" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span><br /><br /><span style="color: #30F;">Sorry this form in development, please call or email for information.</span></p> </div> <!-- begin event info tab--> <div class="TabbedPanelsContent"> <p><span id="sprytextfield7"> <label>Event date <input name="Event date" type="text" id="Event date" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield9"> <label>Event time <input name="Event time" type="text" id="Event time" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield8"><label>Attendance <input name="Attendance" type="text" id="Attendance" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprycheckbox1"> <label> Event location, rooms are available from 6:00 a.m.-12:00 a.m. <em>(check all that apply)</em><br /> <input name="banquet" type="checkbox" id="room1" value="banquet" /> Banquet Room (East or West, capacity 300) <input name="both" type="checkbox" id="room2" value="both" /> Both Rooms (capacity 550) <input name="bar" type="checkbox" id="room3" value="bar" /> Bar Area (capacity 50) </label></span></p> <p><span id="sprytextfield11"> <label>Contact name (day of event) <input name="Contact name" type="text" id="Contact name" size="40" /> </label></span></p> <p><span id="sprytextfield12"> <label>Phone number <input name="Phone number" type="text" id="Phone number" size="15" /> </label> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p> </div> <!-- begin additional info tab--> <div class="TabbedPanelsContent"> <p><span id="sprycheckbox2"> <label> Electronic equipment needed, no extra charge <em>(check all that apply)</em><br /> <input name="DVD" type="checkbox" id="equipment1" value="DVD" /> DVD <input name="VHS" type="checkbox" id="equipment2" value="VHS" /> VHS <input name="built-in screen" type="checkbox" id="equipment3" value="built-in screen" /> built-in screen <input name="built-in projector" type="checkbox" id="equipment4" value="built-in projector" /> built-in projector <input name="cable TV" type="checkbox" id="equipment5" value="cable TV" /> cable TV <input name="Comcast digital radio" type="checkbox" id="equipment6" value="Comcast digital radio" /> Comcast digital radio <input name="wireless internet" type="checkbox" id="equipment7" value="wireless internet" /> wireless internet <input name="wireless mic" type="checkbox" id="equipment8" value="wireless mic" /> wireless mic <input name="laptop" type="checkbox" id="equipment9" value="laptop" /> laptop <br /> <input name="podium w/mic" type="checkbox" id="equipment10" value="podium w/mic" /> podium w/mic <input name="white board" type="checkbox" id="equipment11" value="white board" /> white board <input name="keyboard" type="checkbox" id="equipment12" value="keyboard" /> piano-quality keyboard <br /><br /> </label><label> Additional hardware, fees apply <em>(check all that apply)</em><br /> <input name="stage" type="checkbox" id="equipment13" value="stage" /> stage <input name="dance floor" type="checkbox" id="equipment14" value="dance floor" /> dance floor </label></span></p> <p><span> <label>Questions or comments?<br /> <textarea name="Questions or comments?" id="Questions or comments?" cols="45" rows="2"></textarea> </label> </span></p> </div> <!-- begin submit tab--> <div class="TabbedPanelsContent"> <p><span><span id="sprycheckbox3"> <label> <input name="Agreement" type="checkbox" id="Agreement" value="I understand and agree to be contacted" /> I understand that the information I have provided is for the sole use of Drake Centre and is<em><strong> only for an event request</strong></em>. The Drake Centre Event Coordinator will contact me to confirm date availablility and details of event.</label> <span class="checkboxRequiredMsg">Please make a selection.</span></span></span></p> <p><span> <label> <!--For immediate help please contact 970-492-6473, <br /> 7:00 a.m. – 2:00 p.m. Monday through Friday.<br /> <br />--> <input type="submit" name="submit" id="submit" value="Submit Request" /> </label> </span> <span style="color: #30F;">Sorry this form in development, please call or email for information.</span></p> </div> </div> </div> <p> </p> <p> </p> <p> </p> </form> </div> </div> </div> </div><!-- #BeginLibraryItem "/Library/drake_footer.lbi" --><style type="text/css"> <!-- #copyright { text-align: right; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #919191; } .footer { text-align: right; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #919191; } --> </style> <table width="740" border="0" align="center"> <tr> <td width="733" class="footer">© 2014 Drake Centre | Photo contributions courtesy of Craig Vollmer Photography</td> </tr> </table> <!-- #EndLibraryItem --><script type="text/javascript"> <!-- var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["change"]}); var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {isRequired:false, validateOn:["change"]}); var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "phone_number", {hint:"(000) 000-0000", validateOn:["change"]}); var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "phone_number", {hint:"(000) 000-0000", isRequired:false, validateOn:["change"]}); var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "email", {validateOn:["change"]}); var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "none", {isRequired:false, validateOn:["change"]}); var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "none", {validateOn:["change"]}); var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9", "none", {validateOn:["change"]}); var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11", "none", {validateOn:["change"]}); var sprytextfield12 = new Spry.Widget.ValidationTextField("sprytextfield12", "phone_number", {hint:"(000) 000-0000", validateOn:["change"]}); var sprycheckbox1 = new Spry.Widget.ValidationCheckbox("sprycheckbox1", {maxSelections:3, minSelections:1}); var sprycheckbox2 = new Spry.Widget.ValidationCheckbox("sprycheckbox2", {maxSelections:14, minSelections:1}); var sprycheckbox3 = new Spry.Widget.ValidationCheckbox("sprycheckbox3"); //--> </script> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Contact Form</title> </head> <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <?php ini_set("display_errors", "1"); error_reporting(-1); if($_POST['formSubmitRequest'] == "SubmitRequest") { // get name $name = $_POST['name']; // get address $address = $_POST['address']; // get phone_number $phone_number = $_POST['phone_number']; // get cell_number $cell_number = $_POST['cell_number']; // get email_address $email_address = $_POST['email_address']; // get event_date $event_date = $_POST['event_date']; // get event_time $event_time = $_POST['event_time']; // get attendance $attendance = $_POST['attendance']; // get banquet_room $banquet_room = $_POST['banquet_room']; // get both_rooms $both_rooms = $_POST['both_rooms']; // get bar_area $bar_area = $_POST['bar_area']; // get contact_name $contact_name = $_POST['contact_name']; // get phone_number $phone_number = $_POST['phone_number']; // get dvd $dvd = $_POST['dvd']; // get vhs $vhs = $_POST['vhs']; // get built-in_screen $built-in_screen = $_POST['built-in_screen']; // get built-in_projector $built-in_projector = $_POST['built-in_projector']; // get cable_tv $cable_tv = $_POST['cable_tv']; // get comcast_digital_radio $comcast_digital_radio = $_POST['comcast_digital_radio']; // get wireless_internet $wireless_internet = $_POST['wireless_internet']; // get wireless_mic $wireless_mic = $_POST['wireless_mic']; // get laptop $laptop = $_POST['laptop']; // get podium $podium = $_POST['podium']; // get white_board $white_board = $_POST['white_board']; // get keyboard $keyboard = $_POST['keyboard']; // get stage $stage = $_POST['stage']; // get dance_floor $dance_floor = $_POST['dance_floor']; // get questions $questions = $_POST['questions']; // get i_understand $i_understand = $_POST['i_understand']; $message = $_POST['message']; //$email_from = 'yourname@yourwebsite.com'; $email_from = 'contact@drakecentre.com'; $email_subject = "Drake Centre Event Form"; $email_body = "You have received a new message from the user $name.\n". "Here is the message:\n $message". $visitor_email = $_POST['email']; // sending email $to = "contact@drakecentre.com"; $headers = "From: $email_from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; mail($to,$email_subject,$email_body,$headers); // build message $message = "Drake Centre Event Form.\n\n"; $message .= "name: $name\n\n"; $message .= "address: $address\n\n"; $message .= "phone_number: $phone_number\n\n"; $message .= "cell_number: $cell_number\n\n"; $message .= "email_address: $email_address\n\n"; $message .= "event_date: $event_date\n\n"; $message .= "event_time: $event_time\n\n"; $message .= "attendance: $attendance\n\n"; $message .= "banquet_room: $banquet_room\n\n"; $message .= "both_rooms: $both_rooms\n\n"; $message .= "bar_area: $bar_area\n\n"; $message .= "contact_name: $contact_name\n\n"; $message .= "phone_number: $phone_number\n\n"; $message .= "dvd: $dvd\n\n"; $message .= "questions: $questions\n\n"; $message .= "i_understand: $i_understand\n\n"; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1494469 Share on other sites More sharing options...
davidannis Posted October 23, 2014 Share Posted October 23, 2014 The line mail($to,$email_subject,$email_body,$headers); sends an email message to the address contained in $to, with the subject line contained in $email_subject, and the message contents is whatever is in the variable $email_body but you are trying to send yourself information that you are putting in $message. You need to do something like this: // build message $message = "Drake Centre Event Form.\n\n"; $message .= "name: $name\n\n"; $message .= "address: $address\n\n"; $message .= "phone_number: $phone_number\n\n"; $message .= "cell_number: $cell_number\n\n"; $message .= "email_address: $email_address\n\n"; $message .= "event_date: $event_date\n\n"; $message .= "event_time: $event_time\n\n"; $message .= "attendance: $attendance\n\n"; $message .= "banquet_room: $banquet_room\n\n"; $message .= "both_rooms: $both_rooms\n\n"; $message .= "bar_area: $bar_area\n\n"; $message .= "contact_name: $contact_name\n\n"; $message .= "phone_number: $phone_number\n\n"; $message .= "dvd: $dvd\n\n"; $message .= "questions: $questions\n\n"; mail($to,$email_subject,$message,$headers); What error messages do you get now that they display? Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1494505 Share on other sites More sharing options...
newatthis123 Posted October 23, 2014 Author Share Posted October 23, 2014 Thanks so much, I've already learned some things. I've followed everything you mentioned but still not getting emails or any errors. I'm working in Dreamweaver, it validates the PHP, where would I see the errors? Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1494514 Share on other sites More sharing options...
newatthis123 Posted October 23, 2014 Author Share Posted October 23, 2014 OOO til Tues 28th, hope to continue working on this, thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1494530 Share on other sites More sharing options...
ginerjm Posted October 23, 2014 Share Posted October 23, 2014 Could we possibly see a complete piece of code that shows how you build the contents of the call to mail, followed by (hopefully) the mail call? So much easier to debug the code as it was written and not in pieces that you feel like posting. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1494535 Share on other sites More sharing options...
davidannis Posted October 24, 2014 Share Posted October 24, 2014 I think that perhaps the problem is this line: if($_POST['formSubmitRequest'] == "SubmitRequest") which says only create and send the message if the field formSubmitRequest contains the value SubmitRequest but the button is named submit and the value has a space in it. <input type="submit" name="submit" id="submit" value="Submit Request" /> You need to change the form or the script so that names and values match. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1494626 Share on other sites More sharing options...
newatthis123 Posted October 28, 2014 Author Share Posted October 28, 2014 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Adobe GoLive" /> <link href="drake_d.ico" rel="shortcut icon" /> <title>Drake Centre Contact</title> <link href="css/basic.css" rel="stylesheet" type="text/css" media="all" /> <csscriptdict import="import"> <script type="text/javascript" src="GeneratedItems/CSScriptLib.js"></script> <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script> </csscriptdict> <csactiondict> <script type="text/javascript"><!-- var preloadFlag = false; function preloadImages() { if (document.images) { pre_home_ro = newImage('images/navigation/home_ro.gif'); pre_contact_ro = newImage('images/navigation/contact_ro.gif'); pre_location_ro = newImage('images/navigation/location_ro.gif'); pre_menu_ro = newImage('images/navigation/menu_ro.gif'); pre_accommodations_ro = newImage('images/navigation/accommodations_ro.gif'); preloadFlag = true; } } // --></script> </csactiondict> <csimport user="navigation_comp.html" occur="23"> <csactions> <csaction name="3dc7ce6f0" class="Goto Link" type="onevent" val0="accommodations.html" val1="" urlparams="1"></csaction> <csaction name="3dc819ef1" class="Goto Link" type="onevent" val0="menu.html" val1="" urlparams="1"></csaction> <csaction name="3dc8a3e02" class="Goto Link" type="onevent" val0="location.html" val1="" urlparams="1"></csaction> <csaction name="3dc934a63" class="Goto Link" type="onevent" val0="contact.html" val1="" urlparams="1"></csaction> <csaction name="5cef216b1" class="Goto Link" type="onevent" val0="index.html" val1="" urlparams="1"></csaction> </csactions> <csactiondict> <script type="text/javascript"><!-- CSAct[/*CMP*/ '3dc7ce6f0'] = new Array(CSGotoLink,/*URL*/ 'accommodations.html',''); CSAct[/*CMP*/ '3dc819ef1'] = new Array(CSGotoLink,/*URL*/ 'menu.html',''); CSAct[/*CMP*/ '3dc8a3e02'] = new Array(CSGotoLink,/*URL*/ 'location.html',''); CSAct[/*CMP*/ '3dc934a63'] = new Array(CSGotoLink,/*URL*/ 'contact.html',''); CSAct[/*CMP*/ '5cef216b1'] = new Array(CSGotoLink,/*URL*/ 'index.html',''); // --></script> </csactiondict> </csimport> <style type="text/css"> <!-- body { margin-top: 5px; } --> </style> <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /> <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> <link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- #apDiv1 { position:absolute; left:291px; top:254px; width:388px; height:14px; z-index:7; visibility: visible; } #apDiv1 strong { font-family: Arial, Helvetica, sans-serif; } #apDiv2 { position:absolute; width:242px; height:251px; z-index:6; left: 17px; top: 263px; } #apDiv2 { font-family: Arial, Helvetica, sans-serif; } #apDiv2 { font-size: 12px; } --> </style> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="MM_preloadImages('../images/navigation/home_h.gif','../images/navigation/accommodations_h.gif','../images/navigation/testimonials_h.gif','../images/navigation/location_h.gif','../images/navigation/contact_h.gif',)"> <div style="position:relative;width:740px;height:580px;background-color:#000;margin:auto;-adbe-g:p,5,5;"> <div style="position:absolute;top:1px;left:1px;width:738px;height:578px;"> <div style="position:relative;width:738px;height:578px;background-color:#fff;-adbe-g:p,5,5;"> <div style="position:absolute; top:4px; left:4px; width:730px; height:246px; visibility: visible;"> <div style="position:absolute;top:270px;left:20px;width:255px;height:150px;-adbe-c:c"> <div align="left"> <!--<font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Contact the Drake Centre today to set-up<br /> a personal tour and meeting.<br /> </font>--> </div> <div text-align="left"> <p style="margin-bottom:-12px;"><font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">802 West Drake Road</font></p> <p><font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Fort Collins, Colorado 80526</font></p> <p><font size="6" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">970.492.6473<br /></font></p> <a href="mailto:contact@drakecentre.com">contact@drakecentre.com</a> </div> </div> <div style="position:absolute;top:470px;left:15px;width:139px;height:50px;"> <a href="index.html"><img src="images/drake_centre_sm.gif" alt="" border="0" /></a></div> <!-- <div id="apDiv1"><strong>Request Form </strong></div> --> <div style="position:relative;width:730px;height:246px;background-color:#000;-adbe-g:p,5,5;"> <div style="position:absolute; top:80px; left:5px; width:140px; height:140px; z-index: 1;"> <img src="images/dance_floor.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:0px; left:7px; width:575px; height:80px; z-index: 2;"> <img src="images/contact.gif" alt="" height="80" border="0" /></div> <div style="position:absolute; top:80px; left:150px; width:140px; height:140px; z-index: 3;"> <img src="images/croud.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:80px; left:295px; width:140px; height:140px; z-index: 4;"><img src="images/exterior.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:80px; left:440px; width:140px; height:140px; z-index: 5;"><img src="images/interior.gif" alt="" height="140" width="140" border="0" /></div> </div> </div> <div style="position:absolute;top:531px;left:4px;width:730px;height:42px;"> <div style="position:relative;width:730px;height:42px;background-color:#000;-adbe-g:p,5,5;"><!-- #BeginLibraryItem "/Library/drake_navigation.lbi" --> <script type="text/javascript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <table border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td width="20"> </td> <td><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/navigation/home_h.gif',1)"><img src="images/navigation/home.gif" alt="Home" name="Home" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="accommodations.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Accommodations','','images/navigation/accommodations_h.gif',1)"><img src="images/navigation/accommodations.gif" alt="Accommodations" name="Accommodations" width="108" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="location.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Location','','images/navigation/location_h.gif',1)"><img src="images/navigation/location.gif" alt="Location" name="Location" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="contact.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Contact','','images/navigation/contact_h.gif',1)"><img src="images/navigation/contact.gif" alt="Contact" name="Contact" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/navigation_bar_01.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> </tr> </table> <!-- #EndLibraryItem --></div> </div> <div style="position:absolute; top:262px; left:284px; width:431px; height:90px; -adbe-c:c"> <form action="contact_script.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" >Contact Info</li> <li class="TabbedPanelsTab" >Event Into</li> <li class="TabbedPanelsTab" >Additional Info<br /> </li> <li class="TabbedPanelsTab" >Submit<br /> </li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"> <p><span id="sprytextfield2"> <label>Name <input name="Name" type="text" id="Name" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprytextfield3"> <label>Address <input name="Address" type="text" id="Address" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprytextfield4"> <label>Phone number <input name="Phone number" type="text" id="Phone number" size="15" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span class="textfieldInvalidFormatMsg">Invalid format.</span> <span id="sprytextfield5"> <label>Cell number <input name="Cell number" type="text" id="Cell number" size="15" /> </label> <span class="textfieldRequiredMsg">A value is required.</span> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p> <p><span id="sprytextfield6"> <label>Email address <input name="Email" type="text" id="Email" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span><br /><br /><span style="color: #30F;">Sorry this form in development, please call or email for information.</span></p> </div> <!-- begin event info tab--> <div class="TabbedPanelsContent"> <p><span id="sprytextfield7"> <label>Event date <input name="Event date" type="text" id="Event date" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield9"> <label>Event time <input name="Event time" type="text" id="Event time" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield8"><label>Attendance <input name="Attendance" type="text" id="Attendance" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprycheckbox1"> <label> Event location, rooms are available from 6:00 a.m.-12:00 a.m. <em>(check all that apply)</em><br /> <input name="banquet" type="checkbox" id="room1" value="banquet" /> Banquet Room (East or West, capacity 300) <input name="both" type="checkbox" id="room2" value="both" /> Both Rooms (capacity 550) <input name="bar" type="checkbox" id="room3" value="bar" /> Bar Area (capacity 50) </label></span></p> <p><span id="sprytextfield11"> <label>Contact name (day of event) <input name="Contact name" type="text" id="Contact name" size="40" /> </label></span></p> <p><span id="sprytextfield12"> <label>Phone number <input name="Phone number" type="text" id="Phone number" size="15" /> </label> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p> </div> <!-- begin additional info tab--> <div class="TabbedPanelsContent"> <p><span id="sprycheckbox2"> <label> Electronic equipment needed, no extra charge <em>(check all that apply)</em><br /> <input name="DVD" type="checkbox" id="equipment1" value="DVD" /> DVD <input name="VHS" type="checkbox" id="equipment2" value="VHS" /> VHS <input name="built-in screen" type="checkbox" id="equipment3" value="built-in screen" /> built-in screen <input name="built-in projector" type="checkbox" id="equipment4" value="built-in projector" /> built-in projector <input name="cable TV" type="checkbox" id="equipment5" value="cable TV" /> cable TV <input name="Comcast digital radio" type="checkbox" id="equipment6" value="Comcast digital radio" /> Comcast digital radio <input name="wireless internet" type="checkbox" id="equipment7" value="wireless internet" /> wireless internet <input name="wireless mic" type="checkbox" id="equipment8" value="wireless mic" /> wireless mic <input name="laptop" type="checkbox" id="equipment9" value="laptop" /> laptop <br /> <input name="podium w/mic" type="checkbox" id="equipment10" value="podium w/mic" /> podium w/mic <input name="white board" type="checkbox" id="equipment11" value="white board" /> white board <input name="keyboard" type="checkbox" id="equipment12" value="keyboard" /> piano-quality keyboard <br /><br /> </label><label> Additional hardware, fees apply <em>(check all that apply)</em><br /> <input name="stage" type="checkbox" id="equipment13" value="stage" /> stage <input name="dance floor" type="checkbox" id="equipment14" value="dance floor" /> dance floor </label></span></p> <p><span> <label>Questions or comments?<br /> <textarea name="Questions or comments?" id="Questions or comments?" cols="45" rows="2"></textarea> </label> </span></p> </div> <!-- begin submit tab--> <div class="TabbedPanelsContent"> <p><span><span id="sprycheckbox3"> <label> <input name="Agreement" type="checkbox" id="Agreement" value="I understand and agree to be contacted" /> I understand that the information I have provided is for the sole use of Drake Centre and is<em><strong> only for an event request</strong></em>. The Drake Centre Event Coordinator will contact me to confirm date availablility and details of event.</label> <span class="checkboxRequiredMsg">Please make a selection.</span></span></span></p> <p><span> <label> <!--For immediate help please contact 970-492-6473, <br /> 7:00 a.m. – 2:00 p.m. Monday through Friday.<br /> <br />--> <input type="submit" name="Submit" id="submit" value="Submit" /> </label> </span> <span style="color: #30F;">Sorry this form in development, please call or email for information.</span></p> </div> </div> </div> <p> </p> <p> </p> <p> </p> </form> </div> </div> </div> </div><!-- #BeginLibraryItem "/Library/drake_footer.lbi" --><style type="text/css"> <!-- #copyright { text-align: right; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #919191; } .footer { text-align: right; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #919191; } --> </style> <table width="740" border="0" align="center"> <tr> <td width="733" class="footer">© 2014 Drake Centre | Photo contributions courtesy of Craig Vollmer Photography</td> </tr> </table> <!-- #EndLibraryItem --><script type="text/javascript"> <!-- var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["change"]}); var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {isRequired:false, validateOn:["change"]}); var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "phone_number", {hint:"(000) 000-0000", validateOn:["change"]}); var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "phone_number", {hint:"(000) 000-0000", isRequired:false, validateOn:["change"]}); var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "email", {validateOn:["change"]}); var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "none", {isRequired:false, validateOn:["change"]}); var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "none", {validateOn:["change"]}); var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9", "none", {validateOn:["change"]}); var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11", "none", {validateOn:["change"]}); var sprytextfield12 = new Spry.Widget.ValidationTextField("sprytextfield12", "phone_number", {hint:"(000) 000-0000", validateOn:["change"]}); var sprycheckbox1 = new Spry.Widget.ValidationCheckbox("sprycheckbox1", {maxSelections:3, minSelections:1}); var sprycheckbox2 = new Spry.Widget.ValidationCheckbox("sprycheckbox2", {maxSelections:14, minSelections:1}); var sprycheckbox3 = new Spry.Widget.ValidationCheckbox("sprycheckbox3"); //--> </script> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Contact Form</title> </head> <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <?php ini_set("display_errors", "1"); error_reporting(-1); if($_POST['formSubmit'] == "Submit") { // get name $name = $_POST['name']; // get address $address = $_POST['address']; // get phone_number $phone_number = $_POST['phone_number']; // get cell_number $cell_number = $_POST['cell_number']; // get email_address $email_address = $_POST['email_address']; // get event_date $event_date = $_POST['event_date']; // get event_time $event_time = $_POST['event_time']; // get attendance $attendance = $_POST['attendance']; // get banquet_room $banquet_room = $_POST['banquet_room']; // get both_rooms $both_rooms = $_POST['both_rooms']; // get bar_area $bar_area = $_POST['bar_area']; // get contact_name $contact_name = $_POST['contact_name']; // get phone_number $phone_number = $_POST['phone_number']; // get dvd $dvd = $_POST['dvd']; // get vhs $vhs = $_POST['vhs']; // get built-in_screen $screen = $_POST['screen']; // get built-in_projector $built-in_projector = $_POST['built-in_projector']; // get cable_tv $cable_tv = $_POST['cable_tv']; // get comcast_digital_radio $comcast_digital_radio = $_POST['comcast_digital_radio']; // get wireless_internet $wireless_internet = $_POST['wireless_internet']; // get wireless_mic $wireless_mic = $_POST['wireless_mic']; // get laptop $laptop = $_POST['laptop']; // get podium $podium = $_POST['podium']; // get white_board $white_board = $_POST['white_board']; // get keyboard $keyboard = $_POST['keyboard']; // get stage $stage = $_POST['stage']; // get dance_floor $dance_floor = $_POST['dance_floor']; // get questions $questions = $_POST['questions']; // get i_understand $i_understand = $_POST['i_understand']; $message = $_POST['message']; //build message prior to send mail $message = "Drake Centre Event Form.\n\n"; $message .= "name: $name\n\n"; $message .= "address: $address\n\n"; $message .= "phone_number: $phone_number\n\n"; $message .= "cell_number: $cell_number\n\n"; $message .= "email_address: $email_address\n\n"; $message .= "event_date: $event_date\n\n"; $message .= "event_time: $event_time\n\n"; $message .= "attendance: $attendance\n\n"; $message .= "banquet_room: $banquet_room\n\n"; $message .= "both_rooms: $both_rooms\n\n"; $message .= "bar_area: $bar_area\n\n"; $message .= "contact_name: $contact_name\n\n"; $message .= "phone_number: $phone_number\n\n"; $message .= "dvd: $dvd\n\n"; $message .= "questions: $questions\n\n"; $message .= "i_understand: $i_understand\n\n"; //$email_from = 'yourname@yourwebsite.com'; $email_from = 'contact@drakecentre.com'; $email_subject = "Drake Centre Event Form"; $email_body = "You have received a new message from the user $name.\n". "Here is the message:\n $message". $visitor_email = $_POST['email']; // sending email $to = "contact@drakecentre.com"; $headers = "From: $email_from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; //sends an email message to the address contained in $to, with the subject line contained in $email_subject, and the message contents is whatever is in the variable $email_body //mail($to,$email_subject,$email_body,$headers); mail($to,$email_subject,$message,$headers); ?> </body> </html> Attached is php & html code. I made those last changes that were suggested but still no error messages or emails returned to me. When I click on the Submit button, I remain on that page but nothing happens. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1495050 Share on other sites More sharing options...
tryingtolearn Posted October 28, 2014 Share Posted October 28, 2014 You are going to run into a few problems, Your form names in your .html file do not match your $_POST variables in your .php script The name part of the form is Name but the variable is name Notice the N vs n That happens in a few spots throughout your code. You also are checking for names that aren't in your form (message and questions for instance) Your submit button is named Submit but your .php is looking for formSubmit I would start with all those form names and $_POST names and make sure they match first. Get it to that point and see how much closer things get to working. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1495059 Share on other sites More sharing options...
newatthis123 Posted October 29, 2014 Author Share Posted October 29, 2014 I made all those changes as you suggested above. Now getting an error so thinking that's something positive at least. Parse error: syntax error, unexpected '=' in /home/drakecentre/public_html/contact_script.php on line 81 Here's line 81: $built-in_screen = $_POST['built-in_screen']; I removed "built-in" and just used "screen" it seemed to like that no more errors. But still not receiving emails either, ugh. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1495123 Share on other sites More sharing options...
tryingtolearn Posted October 29, 2014 Share Posted October 29, 2014 You can't just change it to screen if the form field name is still built-in_screen. They always have to match. What is the code above line 81 Paste that exactly how you have it in your page. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1495175 Share on other sites More sharing options...
newatthis123 Posted October 29, 2014 Author Share Posted October 29, 2014 ok good to know that needs to match exactly. Changed that back now no errors but still not working. Code above that line: $VHS = $_POST['VHS']; Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1495178 Share on other sites More sharing options...
tryingtolearn Posted October 29, 2014 Share Posted October 29, 2014 post both of your updated pages Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1495181 Share on other sites More sharing options...
newatthis123 Posted October 29, 2014 Author Share Posted October 29, 2014 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Contact Form</title> </head> <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <?php ini_set("display_errors", "1"); error_reporting(-1); if($_POST['Submit'] == "Submit") { // get name $Name = $_POST['Name']; // get address $Address = $_POST['Address']; // get phone_number $Phone_number = $_POST['Phone_number']; // get cell_number $Cell_number = $_POST['Cell_number']; // get email_address $Email_address = $_POST['Email_address']; // get event_date $Event_date = $_POST['Event_date']; // get event_time $Event_time = $_POST['Event_time']; // get attendance $Attendance = $_POST['Attendance']; // get banquet_room $Banquet_Room = $_POST['Banquet_Room']; // get both_rooms $Both_Rooms = $_POST['Both_Rooms']; // get bar_area $Bar_Area = $_POST['Bar_Area']; // get contact_name $Contact_name = $_POST['Contact_name']; // get phone_number $Phone_number = $_POST['Phone_number']; // get dvd $DVD = $_POST['DVD']; // get vhs $VHS = $_POST['VHS']; // get built-in_screen $built-in_screen = $_POST['built-in_screen']; // get built-in_projector $built-in_projector = $_POST['built-in_projector']; // get cable_tv $cable_tv = $_POST['cable_tv']; // get comcast_digital_radio $Comcast_digital_radio = $_POST['Comcast_digital_radio']; // get wireless_internet $wireless_internet = $_POST['wireless_internet']; // get wireless_mic $wireless_mic = $_POST['wireless_mic']; // get laptop $laptop = $_POST['laptop']; // get podium $podium_w/mic = $_POST['podium_w/mic']; // get white_board $white_board = $_POST['white_board']; // get keyboard $keyboard = $_POST['keyboard']; // get stage $stage = $_POST['stage']; // get dance_floor $dance_floor = $_POST['dance_floor']; // get questions $Questions_or_comments = $_POST['Questions_or_comments']; // get i_understand $I_understand = $_POST['I_understand']; //$message = $_POST['message']; //build message prior to send mail $message = "Drake Centre Event Form.\n\n"; $message .= "Name: $Name\n\n"; $message .= "Address: $Address\n\n"; $message .= "Phone_number: $Phone_number\n\n"; $message .= "Cell_number: $Cell_number\n\n"; $message .= "Email_address: $Email_address\n\n"; $message .= "Event_date: $Event_date\n\n"; $message .= "Event_time: $Event_time\n\n"; $message .= "Attendance: $Attendance\n\n"; $message .= "Banquet_Room: $Banquet_Room\n\n"; $message .= "Both_Rooms: $Both_Rooms\n\n"; $message .= "Bar_Area: $Bar_Area\n\n"; $message .= "Contact_name: $Contact_name\n\n"; $message .= "Phone_number: $Phone_number\n\n"; $message .= "DVD: $DVD\n\n"; $message .= "VHS: $VHS\n\n"; $message .= "built-in_screen: $built-in_screen\n\n"; $message .= "built-in_projector: $built-in_projector\n\n"; $message .= "cable_TV: $cable_TV\n\n"; $message .= "Comcast_digital_radio: $Comcast_digital_radio\n\n"; $message .= "wireless_internet: $wireless_internet\n\n"; $message .= "wireless_mic: $wireless_mic\n\n"; $message .= "laptop: $laptop\n\n"; $message .= "podium_w/mic: $podium_w/mic\n\n"; $message .= "white_board: $white_board\n\n"; $message .= "keyboard: $keyboard\n\n"; $message .= "stage: $stage\n\n"; $message .= "dance_floor: $dance_floor\n\n"; $message .= "Questionf_or_comments: $Questionf_or_comments\n\n"; $message .= "I_understand: $I_understand\n\n"; //$email_from = 'yourname@yourwebsite.com'; $email_from = 'contact@drakecentre.com'; $email_subject = "Drake Centre Event Form"; $email_body = "You have received a new message from the user $name.\n". "Here is the message:\n $message". $visitor_email = $_POST['email']; // sending email $to = "contact@drakecentre.com"; $headers = "From: $email_from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; //sends an email message to the address contained in $to, with the subject line contained in $email_subject, and the message contents is whatever is in the variable $email_body //mail($to,$email_subject,$email_body,$headers); mail($to,$email_subject,$message,$headers); ?> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Adobe GoLive" /> <link href="drake_d.ico" rel="shortcut icon" /> <title>Drake Centre Contact</title> <link href="css/basic.css" rel="stylesheet" type="text/css" media="all" /> <csscriptdict import="import"> <script type="text/javascript" src="GeneratedItems/CSScriptLib.js"></script> <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script> </csscriptdict> <csactiondict> <script type="text/javascript"><!-- var preloadFlag = false; function preloadImages() { if (document.images) { pre_home_ro = newImage('images/navigation/home_ro.gif'); pre_contact_ro = newImage('images/navigation/contact_ro.gif'); pre_location_ro = newImage('images/navigation/location_ro.gif'); pre_menu_ro = newImage('images/navigation/menu_ro.gif'); pre_accommodations_ro = newImage('images/navigation/accommodations_ro.gif'); preloadFlag = true; } } // --></script> </csactiondict> <csimport user="navigation_comp.html" occur="23"> <csactions> <csaction name="3dc7ce6f0" class="Goto Link" type="onevent" val0="accommodations.html" val1="" urlparams="1"></csaction> <csaction name="3dc819ef1" class="Goto Link" type="onevent" val0="menu.html" val1="" urlparams="1"></csaction> <csaction name="3dc8a3e02" class="Goto Link" type="onevent" val0="location.html" val1="" urlparams="1"></csaction> <csaction name="3dc934a63" class="Goto Link" type="onevent" val0="contact.html" val1="" urlparams="1"></csaction> <csaction name="5cef216b1" class="Goto Link" type="onevent" val0="index.html" val1="" urlparams="1"></csaction> </csactions> <csactiondict> <script type="text/javascript"><!-- CSAct[/*CMP*/ '3dc7ce6f0'] = new Array(CSGotoLink,/*URL*/ 'accommodations.html',''); CSAct[/*CMP*/ '3dc819ef1'] = new Array(CSGotoLink,/*URL*/ 'menu.html',''); CSAct[/*CMP*/ '3dc8a3e02'] = new Array(CSGotoLink,/*URL*/ 'location.html',''); CSAct[/*CMP*/ '3dc934a63'] = new Array(CSGotoLink,/*URL*/ 'contact.html',''); CSAct[/*CMP*/ '5cef216b1'] = new Array(CSGotoLink,/*URL*/ 'index.html',''); // --></script> </csactiondict> </csimport> <style type="text/css"> <!-- body { margin-top: 5px; } --> </style> <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /> <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> <link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- #apDiv1 { position:absolute; left:291px; top:254px; width:388px; height:14px; z-index:7; visibility: visible; } #apDiv1 strong { font-family: Arial, Helvetica, sans-serif; } #apDiv2 { position:absolute; width:242px; height:251px; z-index:6; left: 17px; top: 263px; } #apDiv2 { font-family: Arial, Helvetica, sans-serif; } #apDiv2 { font-size: 12px; } --> </style> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="MM_preloadImages('../images/navigation/home_h.gif','../images/navigation/accommodations_h.gif','../images/navigation/testimonials_h.gif','../images/navigation/location_h.gif','../images/navigation/contact_h.gif',)"> <div style="position:relative;width:740px;height:580px;background-color:#000;margin:auto;-adbe-g:p,5,5;"> <div style="position:absolute;top:1px;left:1px;width:738px;height:578px;"> <div style="position:relative;width:738px;height:578px;background-color:#fff;-adbe-g:p,5,5;"> <div style="position:absolute; top:4px; left:4px; width:730px; height:246px; visibility: visible;"> <div style="position:absolute;top:270px;left:20px;width:255px;height:150px;-adbe-c:c"> <div align="left"> <!--<font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Contact the Drake Centre today to set-up<br /> a personal tour and meeting.<br /> </font>--> </div> <div text-align="left"> <p style="margin-bottom:-12px;"><font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">802 West Drake Road</font></p> <p><font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Fort Collins, Colorado 80526</font></p> <p><font size="6" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">970.492.6473<br /></font></p> <a href="mailto:contact@drakecentre.com">contact@drakecentre.com</a> </div> </div> <div style="position:absolute;top:470px;left:15px;width:139px;height:50px;"> <a href="index.html"><img src="images/drake_centre_sm.gif" alt="" border="0" /></a></div> <!-- <div id="apDiv1"><strong>Request Form </strong></div> --> <div style="position:relative;width:730px;height:246px;background-color:#000;-adbe-g:p,5,5;"> <div style="position:absolute; top:80px; left:5px; width:140px; height:140px; z-index: 1;"> <img src="images/dance_floor.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:0px; left:7px; width:575px; height:80px; z-index: 2;"> <img src="images/contact.gif" alt="" height="80" border="0" /></div> <div style="position:absolute; top:80px; left:150px; width:140px; height:140px; z-index: 3;"> <img src="images/croud.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:80px; left:295px; width:140px; height:140px; z-index: 4;"><img src="images/exterior.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:80px; left:440px; width:140px; height:140px; z-index: 5;"><img src="images/interior.gif" alt="" height="140" width="140" border="0" /></div> </div> </div> <div style="position:absolute;top:531px;left:4px;width:730px;height:42px;"> <div style="position:relative;width:730px;height:42px;background-color:#000;-adbe-g:p,5,5;"><!-- #BeginLibraryItem "/Library/drake_navigation.lbi" --> <script type="text/javascript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <table border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td width="20"> </td> <td><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/navigation/home_h.gif',1)"><img src="images/navigation/home.gif" alt="Home" name="Home" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="accommodations.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Accommodations','','images/navigation/accommodations_h.gif',1)"><img src="images/navigation/accommodations.gif" alt="Accommodations" name="Accommodations" width="108" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="location.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Location','','images/navigation/location_h.gif',1)"><img src="images/navigation/location.gif" alt="Location" name="Location" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="contact.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Contact','','images/navigation/contact_h.gif',1)"><img src="images/navigation/contact.gif" alt="Contact" name="Contact" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/navigation_bar_01.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> </tr> </table> <!-- #EndLibraryItem --></div> </div> <div style="position:absolute; top:262px; left:284px; width:431px; height:90px; -adbe-c:c"> <form action="contact_script.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" >Contact Info</li> <li class="TabbedPanelsTab" >Event Into</li> <li class="TabbedPanelsTab" >Additional Info<br /> </li> <li class="TabbedPanelsTab" >Submit<br /> </li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"> <p><span id="sprytextfield2"> <label>Name <input name="Name" type="text" id="Name" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprytextfield3"> <label>Address <input name="Address" type="text" id="Address" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprytextfield4"> <label>Phone number <input name="Phone number" type="text" id="Phone number" size="15" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span class="textfieldInvalidFormatMsg">Invalid format.</span> <span id="sprytextfield5"> <label>Cell number <input name="Cell number" type="text" id="Cell number" size="15" /> </label> <span class="textfieldRequiredMsg">A value is required.</span> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p> <p><span id="sprytextfield6"> <label>Email address <input name="Email" type="text" id="Email" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span><br /><br /><span style="color: #30F;">Sorry this form in development, please call or email for information.</span></p> </div> <!-- begin event info tab--> <div class="TabbedPanelsContent"> <p><span id="sprytextfield7"> <label>Event date <input name="Event date" type="text" id="Event date" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield9"> <label>Event time <input name="Event time" type="text" id="Event time" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield8"><label>Attendance <input name="Attendance" type="text" id="Attendance" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprycheckbox1"> <label> Event location, rooms are available from 6:00 a.m.-12:00 a.m. <em>(check all that apply)</em><br /> <input name="banquet" type="checkbox" id="room1" value="banquet" /> Banquet Room (East or West, capacity 300) <input name="both" type="checkbox" id="room2" value="both" /> Both Rooms (capacity 550) <input name="bar" type="checkbox" id="room3" value="bar" /> Bar Area (capacity 50) </label></span></p> <p><span id="sprytextfield11"> <label>Contact name (day of event) <input name="Contact name" type="text" id="Contact name" size="40" /> </label></span></p> <p><span id="sprytextfield12"> <label>Phone number <input name="Phone number" type="text" id="Phone number" size="15" /> </label> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p> </div> <!-- begin additional info tab--> <div class="TabbedPanelsContent"> <p><span id="sprycheckbox2"> <label> Electronic equipment needed, no extra charge <em>(check all that apply)</em><br /> <input name="DVD" type="checkbox" id="equipment1" value="DVD" /> DVD <input name="VHS" type="checkbox" id="equipment2" value="VHS" /> VHS <input name="built-in screen" type="checkbox" id="equipment3" value="built-in screen" /> built-in screen <input name="built-in projector" type="checkbox" id="equipment4" value="built-in projector" /> built-in projector <input name="cable TV" type="checkbox" id="equipment5" value="cable TV" /> cable TV <input name="Comcast digital radio" type="checkbox" id="equipment6" value="Comcast digital radio" /> Comcast digital radio <input name="wireless internet" type="checkbox" id="equipment7" value="wireless internet" /> wireless internet <input name="wireless mic" type="checkbox" id="equipment8" value="wireless mic" /> wireless mic <input name="laptop" type="checkbox" id="equipment9" value="laptop" /> laptop <br /> <input name="podium w/mic" type="checkbox" id="equipment10" value="podium w/mic" /> podium w/mic <input name="white board" type="checkbox" id="equipment11" value="white board" /> white board <input name="keyboard" type="checkbox" id="equipment12" value="keyboard" /> piano-quality keyboard <br /><br /> </label><label> Additional hardware, fees apply <em>(check all that apply)</em><br /> <input name="stage" type="checkbox" id="equipment13" value="stage" /> stage <input name="dance floor" type="checkbox" id="equipment14" value="dance floor" /> dance floor </label></span></p> <p><span> <label>Questions or comments?<br /> <textarea name="Questions or comments?" id="Questions or comments?" cols="45" rows="2"></textarea> </label> </span></p> </div> <!-- begin submit tab--> <div class="TabbedPanelsContent"> <p><span><span id="sprycheckbox3"> <label> <input name="Agreement" type="checkbox" id="Agreement" value="I understand and agree to be contacted" /> I understand that the information I have provided is for the sole use of Drake Centre and is<em><strong> only for an event request</strong></em>. The Drake Centre Event Coordinator will contact me to confirm date availablility and details of event.</label> <span class="checkboxRequiredMsg">Please make a selection.</span></span></span></p> <p><span> <label> <!--For immediate help please contact 970-492-6473, <br /> 7:00 a.m. – 2:00 p.m. Monday through Friday.<br /> <br />--> <input type="submit" name="Submit" id="submit" value="Submit" /> </label> </span> <span style="color: #30F;">Sorry this form in development, please call or email for information.</span></p> </div> </div> </div> <p> </p> <p> </p> <p> </p> </form> </div> </div> </div> </div><!-- #BeginLibraryItem "/Library/drake_footer.lbi" --><style type="text/css"> <!-- #copyright { text-align: right; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #919191; } .footer { text-align: right; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #919191; } --> </style> <table width="740" border="0" align="center"> <tr> <td width="733" class="footer">© 2014 Drake Centre | Photo contributions courtesy of Craig Vollmer Photography</td> </tr> </table> <!-- #EndLibraryItem --><script type="text/javascript"> <!-- var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["change"]}); var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {isRequired:false, validateOn:["change"]}); var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "phone_number", {hint:"(000) 000-0000", validateOn:["change"]}); var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "phone_number", {hint:"(000) 000-0000", isRequired:false, validateOn:["change"]}); var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "email", {validateOn:["change"]}); var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "none", {isRequired:false, validateOn:["change"]}); var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "none", {validateOn:["change"]}); var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9", "none", {validateOn:["change"]}); var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11", "none", {validateOn:["change"]}); var sprytextfield12 = new Spry.Widget.ValidationTextField("sprytextfield12", "phone_number", {hint:"(000) 000-0000", validateOn:["change"]}); var sprycheckbox1 = new Spry.Widget.ValidationCheckbox("sprycheckbox1", {maxSelections:3, minSelections:1}); var sprycheckbox2 = new Spry.Widget.ValidationCheckbox("sprycheckbox2", {maxSelections:14, minSelections:1}); var sprycheckbox3 = new Spry.Widget.ValidationCheckbox("sprycheckbox3"); //--> </script> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1495183 Share on other sites More sharing options...
tryingtolearn Posted October 29, 2014 Share Posted October 29, 2014 You still have a ton of differences between the names in the form fields and your $_POST statements. Example: Your email field in your form is like this <input name="Email" type="text" id="Email" size="40" /> Your checking in your script like this $Email_address = $_POST['Email_address']; You named it Email in your form but assigning it Email_address in your process That wont work. They have to be the same. ------ Next - avoid using the - of / Remove those from names and variables. go back through both forms and make them the same Oh and add a } after mail($to,$email_subject,$message,$headers); to close the open if statement from the top if($_POST['Submit'] == "Submit") { Thats alot right now but its a start. Once thats working you are going to have to look into the security of the form. Not sure if you are aware of that or not. but we can tackle the form actually working first... Hope that all makes sense. Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1495193 Share on other sites More sharing options...
newatthis123 Posted October 30, 2014 Author Share Posted October 30, 2014 I had been using the labels rather than the names. Have changed all those now so they should match. Not sure what you meant "avoid using the - of / " search both html and php and did not find any. Thanks so much for your patience with me, I really am learning a lot. Still not receiving errors or getting emails to come back to me though. Wondering whether the $email_from $email_to coding is correct? Attaching code here again: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Contact Form</title> </head> <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <?php ini_set("display_errors", "1"); error_reporting(-1); if($_POST['Submit'] == "Submit") { // get name $Name = $_POST['Name']; // get address $Address = $_POST['Address']; // get phone_number $Phone_number = $_POST['Phone_number']; // get cell_number $Cell_number = $_POST['Cell_number']; // get email_address $Email = $_POST['Email']; // get event_date $Event_date = $_POST['Event_date']; // get event_time $Event_time = $_POST['Event_time']; // get attendance $Attendance = $_POST['Attendance']; // get banquet_room $banquet = $_POST['banquet']; // get both_rooms $both = $_POST['both']; // get bar_area $bar = $_POST['bar']; // get contact_name $Contact_name = $_POST['Contact_name']; // get phone_number $Phone_number = $_POST['Phone_number']; // get dvd $DVD = $_POST['DVD']; // get vhs $VHS = $_POST['VHS']; // get built-in_screen $built-in_screen = $_POST['built-in_screen']; // get built-in_projector $built-in_projector = $_POST['built-in_projector']; // get cable_tv $cable_TV = $_POST['cable_TV']; // get comcast_digital_radio $Comcast_digital_radio = $_POST['Comcast_digital_radio']; // get wireless_internet $wireless_internet = $_POST['wireless_internet']; // get wireless_mic $wireless_mic = $_POST['wireless_mic']; // get laptop $laptop = $_POST['laptop']; // get podium $podium_w/mic = $_POST['podium_w/mic']; // get white_board $white_board = $_POST['white_board']; // get keyboard $keyboard = $_POST['keyboard']; // get stage $stage = $_POST['stage']; // get dance_floor $dance_floor = $_POST['dance_floor']; // get questions $Questions or comments? = $_POST['Questions or comments?']; // get i_understand $Agreement = $_POST['Agreement']; //$message = $_POST['message']; //build message prior to send mail $message = "Drake Centre Event Form.\n\n"; $message .= "Name: $Name\n\n"; $message .= "Address: $Address\n\n"; $message .= "Phone_number: $Phone_number\n\n"; $message .= "Cell_number: $Cell_number\n\n"; $message .= "Email: $Email\n\n"; $message .= "Event_date: $Event_date\n\n"; $message .= "Event_time: $Event_time\n\n"; $message .= "Attendance: $Attendance\n\n"; $message .= "banquet: $banquet\n\n"; $message .= "both: $both\n\n"; $message .= "bar: $bar\n\n"; $message .= "Contact_name: $Contact_name\n\n"; $message .= "Phone_number: $Phone_number\n\n"; $message .= "DVD: $DVD\n\n"; $message .= "VHS: $VHS\n\n"; $message .= "built-in_screen: $built-in_screen\n\n"; $message .= "built-in_projector: $built-in_projector\n\n"; $message .= "cable_TV: $cable_TV\n\n"; $message .= "Comcast_digital_radio: $Comcast_digital_radio\n\n"; $message .= "wireless_internet: $wireless_internet\n\n"; $message .= "wireless_mic: $wireless_mic\n\n"; $message .= "laptop: $laptop\n\n"; $message .= "podium_w/mic: $podium_w/mic\n\n"; $message .= "white_board: $white_board\n\n"; $message .= "keyboard: $keyboard\n\n"; $message .= "stage: $stage\n\n"; $message .= "dance_floor: $dance_floor\n\n"; $message .= "Questions or comments?: $Questions or comments?\n\n"; $message .= "Agreement: $Agreement\n\n"; //$email_from = 'yourname@yourwebsite.com'; $email_from = 'contact@drakecentre.com'; $email_subject = "Drake Centre Event Form"; $email_body = "You have received a new message from the user $name.\n". "Here is the message:\n $message". $visitor_email = $_POST['email']; // sending email $email_to = "contact@drakecentre.com"; $headers = "From: $email_from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; //sends an email message to the address contained in $to, with the subject line contained in $email_subject, and the message contents is whatever is in the variable $email_body //mail($to,$email_subject,$email_body,$headers); //mail($to,$email_subject,$message,$headers); @mail($email_to, $email_subject, $email_message, $headers); } ?> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Adobe GoLive" /> <link href="drake_d.ico" rel="shortcut icon" /> <title>Drake Centre Contact</title> <link href="css/basic.css" rel="stylesheet" type="text/css" media="all" /> <csscriptdict import="import"> <script type="text/javascript" src="GeneratedItems/CSScriptLib.js"></script> <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script> </csscriptdict> <csactiondict> <script type="text/javascript"><!-- var preloadFlag = false; function preloadImages() { if (document.images) { pre_home_ro = newImage('images/navigation/home_ro.gif'); pre_contact_ro = newImage('images/navigation/contact_ro.gif'); pre_location_ro = newImage('images/navigation/location_ro.gif'); pre_menu_ro = newImage('images/navigation/menu_ro.gif'); pre_accommodations_ro = newImage('images/navigation/accommodations_ro.gif'); preloadFlag = true; } } // --></script> </csactiondict> <csimport user="navigation_comp.html" occur="23"> <csactions> <csaction name="3dc7ce6f0" class="Goto Link" type="onevent" val0="accommodations.html" val1="" urlparams="1"></csaction> <csaction name="3dc819ef1" class="Goto Link" type="onevent" val0="menu.html" val1="" urlparams="1"></csaction> <csaction name="3dc8a3e02" class="Goto Link" type="onevent" val0="location.html" val1="" urlparams="1"></csaction> <csaction name="3dc934a63" class="Goto Link" type="onevent" val0="contact.html" val1="" urlparams="1"></csaction> <csaction name="5cef216b1" class="Goto Link" type="onevent" val0="index.html" val1="" urlparams="1"></csaction> </csactions> <csactiondict> <script type="text/javascript"><!-- CSAct[/*CMP*/ '3dc7ce6f0'] = new Array(CSGotoLink,/*URL*/ 'accommodations.html',''); CSAct[/*CMP*/ '3dc819ef1'] = new Array(CSGotoLink,/*URL*/ 'menu.html',''); CSAct[/*CMP*/ '3dc8a3e02'] = new Array(CSGotoLink,/*URL*/ 'location.html',''); CSAct[/*CMP*/ '3dc934a63'] = new Array(CSGotoLink,/*URL*/ 'contact.html',''); CSAct[/*CMP*/ '5cef216b1'] = new Array(CSGotoLink,/*URL*/ 'index.html',''); // --></script> </csactiondict> </csimport> <style type="text/css"> <!-- body { margin-top: 5px; } --> </style> <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /> <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> <link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- #apDiv1 { position:absolute; left:291px; top:254px; width:388px; height:14px; z-index:7; visibility: visible; } #apDiv1 strong { font-family: Arial, Helvetica, sans-serif; } #apDiv2 { position:absolute; width:242px; height:251px; z-index:6; left: 17px; top: 263px; } #apDiv2 { font-family: Arial, Helvetica, sans-serif; } #apDiv2 { font-size: 12px; } --> </style> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="MM_preloadImages('../images/navigation/home_h.gif','../images/navigation/accommodations_h.gif','../images/navigation/testimonials_h.gif','../images/navigation/location_h.gif','../images/navigation/contact_h.gif',)"> <div style="position:relative;width:740px;height:580px;background-color:#000;margin:auto;-adbe-g:p,5,5;"> <div style="position:absolute;top:1px;left:1px;width:738px;height:578px;"> <div style="position:relative;width:738px;height:578px;background-color:#fff;-adbe-g:p,5,5;"> <div style="position:absolute; top:4px; left:4px; width:730px; height:246px; visibility: visible;"> <div style="position:absolute;top:270px;left:20px;width:255px;height:150px;-adbe-c:c"> <div align="left"> <!--<font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Contact the Drake Centre today to set-up<br /> a personal tour and meeting.<br /> </font>--> </div> <div text-align="left"> <p style="margin-bottom:-12px;"><font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">802 West Drake Road</font></p> <p><font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Fort Collins, Colorado 80526</font></p> <p><font size="6" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">970.492.6473<br /></font></p> <a href="mailto:contact@drakecentre.com">contact@drakecentre.com</a> </div> </div> <div style="position:absolute;top:470px;left:15px;width:139px;height:50px;"> <a href="index.html"><img src="images/drake_centre_sm.gif" alt="" border="0" /></a></div> <!-- <div id="apDiv1"><strong>Request Form </strong></div> --> <div style="position:relative;width:730px;height:246px;background-color:#000;-adbe-g:p,5,5;"> <div style="position:absolute; top:80px; left:5px; width:140px; height:140px; z-index: 1;"> <img src="images/dance_floor.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:0px; left:7px; width:575px; height:80px; z-index: 2;"> <img src="images/contact.gif" alt="" height="80" border="0" /></div> <div style="position:absolute; top:80px; left:150px; width:140px; height:140px; z-index: 3;"> <img src="images/croud.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:80px; left:295px; width:140px; height:140px; z-index: 4;"><img src="images/exterior.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:80px; left:440px; width:140px; height:140px; z-index: 5;"><img src="images/interior.gif" alt="" height="140" width="140" border="0" /></div> </div> </div> <div style="position:absolute;top:531px;left:4px;width:730px;height:42px;"> <div style="position:relative;width:730px;height:42px;background-color:#000;-adbe-g:p,5,5;"><!-- #BeginLibraryItem "/Library/drake_navigation.lbi" --> <script type="text/javascript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <table border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td width="20"> </td> <td><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/navigation/home_h.gif',1)"><img src="images/navigation/home.gif" alt="Home" name="Home" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="accommodations.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Accommodations','','images/navigation/accommodations_h.gif',1)"><img src="images/navigation/accommodations.gif" alt="Accommodations" name="Accommodations" width="108" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="location.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Location','','images/navigation/location_h.gif',1)"><img src="images/navigation/location.gif" alt="Location" name="Location" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="contact.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Contact','','images/navigation/contact_h.gif',1)"><img src="images/navigation/contact.gif" alt="Contact" name="Contact" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/navigation_bar_01.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> </tr> </table> <!-- #EndLibraryItem --></div> </div> <div style="position:absolute; top:262px; left:284px; width:431px; height:90px; -adbe-c:c"> <form action="contact_script.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" >Contact Info</li> <li class="TabbedPanelsTab" >Event Into</li> <li class="TabbedPanelsTab" >Additional Info<br /> </li> <li class="TabbedPanelsTab" >Submit<br /> </li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"> <p><span id="sprytextfield2"> <label>Name <input name="Name" type="text" id="Name" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprytextfield3"> <label>Address <input name="Address" type="text" id="Address" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprytextfield4"> <label>Phone number <input name="Phone number" type="text" id="Phone number" size="15" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span class="textfieldInvalidFormatMsg">Invalid format.</span> <span id="sprytextfield5"> <label>Cell number <input name="Cell number" type="text" id="Cell number" size="15" /> </label> <span class="textfieldRequiredMsg">A value is required.</span> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p> <p><span id="sprytextfield6"> <label>Email address <input name="Email" type="text" id="Email" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span><br /><br /><span style="color: #30F;">Sorry this form in development, please call or email for information.</span></p> </div> <!-- begin event info tab--> <div class="TabbedPanelsContent"> <p><span id="sprytextfield7"> <label>Event date <input name="Event date" type="text" id="Event date" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield9"> <label>Event time <input name="Event time" type="text" id="Event time" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield8"><label>Attendance <input name="Attendance" type="text" id="Attendance" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprycheckbox1"> <label> Event location, rooms are available from 6:00 a.m.-12:00 a.m. <em>(check all that apply)</em><br /> <input name="banquet" type="checkbox" id="room1" value="banquet" /> Banquet Room (East or West, capacity 300) <input name="both" type="checkbox" id="room2" value="both" /> Both Rooms (capacity 550) <input name="bar" type="checkbox" id="room3" value="bar" /> Bar Area (capacity 50) </label></span></p> <p><span id="sprytextfield11"> <label>Contact name (day of event) <input name="Contact name" type="text" id="Contact name" size="40" /> </label></span></p> <p><span id="sprytextfield12"> <label>Phone number <input name="Phone number" type="text" id="Phone number" size="15" /> </label> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p> </div> <!-- begin additional info tab--> <div class="TabbedPanelsContent"> <p><span id="sprycheckbox2"> <label> Electronic equipment needed, no extra charge <em>(check all that apply)</em><br /> <input name="DVD" type="checkbox" id="equipment1" value="DVD" /> DVD <input name="VHS" type="checkbox" id="equipment2" value="VHS" /> VHS <input name="built-in screen" type="checkbox" id="equipment3" value="built-in screen" /> built-in screen <input name="built-in projector" type="checkbox" id="equipment4" value="built-in projector" /> built-in projector <input name="cable TV" type="checkbox" id="equipment5" value="cable TV" /> cable TV <input name="Comcast digital radio" type="checkbox" id="equipment6" value="Comcast digital radio" /> Comcast digital radio <input name="wireless internet" type="checkbox" id="equipment7" value="wireless internet" /> wireless internet <input name="wireless mic" type="checkbox" id="equipment8" value="wireless mic" /> wireless mic <input name="laptop" type="checkbox" id="equipment9" value="laptop" /> laptop <br /> <input name="podium w/mic" type="checkbox" id="equipment10" value="podium w/mic" /> podium w/mic <input name="white board" type="checkbox" id="equipment11" value="white board" /> white board <input name="keyboard" type="checkbox" id="equipment12" value="keyboard" /> piano-quality keyboard <br /><br /> </label><label> Additional hardware, fees apply <em>(check all that apply)</em><br /> <input name="stage" type="checkbox" id="equipment13" value="stage" /> stage <input name="dance floor" type="checkbox" id="equipment14" value="dance floor" /> dance floor </label></span></p> <p><span> <label>Questions or comments?<br /> <textarea name="Questions or comments?" id="Questions or comments?" cols="45" rows="2"></textarea> </label> </span></p> </div> <!-- begin submit tab--> <div class="TabbedPanelsContent"> <p><span><span id="sprycheckbox3"> <label> <input name="Agreement" type="checkbox" id="Agreement" value="I understand and agree to be contacted" /> I understand that the information I have provided is for the sole use of Drake Centre and is<em><strong> only for an event request</strong></em>. The Drake Centre Event Coordinator will contact me to confirm date availablility and details of event.</label> <span class="checkboxRequiredMsg">Please make a selection.</span></span></span></p> <p><span> <label> <!--For immediate help please contact 970-492-6473, <br /> 7:00 a.m. – 2:00 p.m. Monday through Friday.<br /> <br />--> <input type="submit" name="Submit" id="submit" value="Submit" /> </label> </span> <span style="color: #30F;">Sorry this form in development, please call or email for information.</span></p> </div> </div> </div> <p> </p> <p> </p> <p> </p> </form> </div> </div> </div> </div><!-- #BeginLibraryItem "/Library/drake_footer.lbi" --><style type="text/css"> <!-- #copyright { text-align: right; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #919191; } .footer { text-align: right; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #919191; } --> </style> <table width="740" border="0" align="center"> <tr> <td width="733" class="footer">© 2014 Drake Centre | Photo contributions courtesy of Craig Vollmer Photography</td> </tr> </table> <!-- #EndLibraryItem --><script type="text/javascript"> <!-- var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["change"]}); var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {isRequired:false, validateOn:["change"]}); var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "phone_number", {hint:"(000) 000-0000", validateOn:["change"]}); var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "phone_number", {hint:"(000) 000-0000", isRequired:false, validateOn:["change"]}); var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "email", {validateOn:["change"]}); var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "none", {isRequired:false, validateOn:["change"]}); var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "none", {validateOn:["change"]}); var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9", "none", {validateOn:["change"]}); var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11", "none", {validateOn:["change"]}); var sprytextfield12 = new Spry.Widget.ValidationTextField("sprytextfield12", "phone_number", {hint:"(000) 000-0000", validateOn:["change"]}); var sprycheckbox1 = new Spry.Widget.ValidationCheckbox("sprycheckbox1", {maxSelections:3, minSelections:1}); var sprycheckbox2 = new Spry.Widget.ValidationCheckbox("sprycheckbox2", {maxSelections:14, minSelections:1}); var sprycheckbox3 = new Spry.Widget.ValidationCheckbox("sprycheckbox3"); //--> </script> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1495282 Share on other sites More sharing options...
tryingtolearn Posted October 30, 2014 Share Posted October 30, 2014 Well kudos for sticking with it. Here is what I did First went through and made all the html form field names and the .php $_POST names and variables match. Then addressed the validation part We have to test if a variable has a value, if you call a variable and it doesn't have a value you will get undefined index errors (Probably why you weren't getting emails) I used two different php functions for this isset() and empty() Read those pages for the difference between the two. I use empty() on the text inputs and isset() on the checkboxes For example: // get name if(!empty($_POST['Name'])){ $Name = htmlentities($_POST['Name']); }else{ $Name = "They didnt enter a name"; } this is saying if the name field of the form is NOT empty (The ! is for the not) the whatever they typed in that form field is now assigned to the variable $Name else (Meaning that form field was blank) - The string "They didnt enter a name is assigned to the variable $Name either way $Name now has a value to it so you wont get any undefined errors when you use it later on in your script. Next - I added some security to your form because you shouldn't trust any data entered in your form because bad things can happen. Read about form security to get all kinds of examples. In your form I just added htmlentities() to all of the text input fields as you can see in the above example. I urge you to read up on that topic and create a security level you feel comfortable with using... With all that said, the forms should be working for you now. but when I tested it, I found the form a bit difficult to use. If you miss a step that you require but its on a different tab you dont know what you missed unless you click on that tab again. Thats just fyi because all items on your page should guide the user, not require them to figure things out. Just my 2 cents... Hope this helps you out. And if you are interested in learning more Ill suggest any of the books written by Larry Ullman or check out his site. Great info all around there... contact_script.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Contact Form</title> </head> <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <?php ini_set("display_errors", "1"); error_reporting(-1); if($_POST['Submit'] == "Submit") { // get name if(!empty($_POST['Name'])){ $Name = htmlentities($_POST['Name']); }else{ $Name = "They didnt enter a name"; } // get address if(!empty($_POST['Address'])){ $Address = htmlentities($_POST['Address']); }else{ $Address = "They didnt enter an address"; } // get phone_number if(!empty($_POST['Phone_number'])){ $Phone_number = htmlentities($_POST['Phone_number']); }else{ $Phone_number = "They didnt enter a phone number"; } // get cell_number if(!empty($_POST['Cell_number'])){ $Cell_number = htmlentities($_POST['Cell_number']); }else{ $Cell_number = "They didnt enter a cell number"; } // get email_address if(!empty($_POST['Email'])){ $Email = htmlentities($_POST['Email']); }else{ $Email = "They didnt enter an email"; } // get event_date if(!empty($_POST['Event_date'])){ $Event_date = htmlentities($_POST['Event_date']); }else{ $Event_date = "They didnt enter an event date"; } // get event_time if(!empty($_POST['Event_time'])){ $Event_time = htmlentities($_POST['Event_time']); }else{ $Event_time = "They didnt enter an event time"; } // get attendance if(!empty($_POST['Attendance'])){ $Attendance = htmlentities($_POST['Attendance']); }else{ $Attendance = "They didnt enter an attendance"; } // get banquet_room if(!isset($_POST['banquet'])){ $banquet = "n/a"; }else{ $banquet = $_POST['banquet']; } // get both_rooms if(!isset($_POST['both'])){ $both = "n/a"; }else{ $both = $_POST['both']; } // get bar_area if(!isset($_POST['bar'])){ $bar = "n/a"; }else{ $bar = $_POST['bar']; } // get contact_name if(!empty($_POST['Contact_name'])){ $Contact_name = htmlentities($_POST['Contact_name']); }else{ $Contact_name = "They didnt enter a contact name"; } // get phone_number if(!empty($_POST['Phone_number'])){ $Phone_number = htmlentities($_POST['Phone_number']); }else{ $Phone_number = "They didnt enter a phone number"; } // get phone_number if(!empty($_POST['Cell_number'])){ $Cell_number = htmlentities($_POST['Cell_number']); }else{ $Cell_number = "They didnt enter a cell number"; } // get dvd if(!isset($_POST['DVD'])){ $DVD = "n/a"; }else{ $DVD = $_POST['DVD']; } // get vhs if(!isset($_POST['VHS'])){ $VHS = "n/a"; }else{ $VHS = $_POST['VHS']; } // get built-in_screen if(!isset($_POST['built_in_screen'])){ $built_in_screen = "n/a"; }else{ $built_in_screen = $_POST['built_in_screen']; } // get built-in_projector if(!isset($_POST['built_in_projector'])){ $built_in_projector = "n/a"; }else{ $built_in_projector = $_POST['built_in_projector']; } // get cable_tv if(!isset($_POST['cable_TV'])){ $cable_TV = "n/a"; }else{ $cable_TV = $_POST['cable_TV']; } // get comcast_digital_radio if(!isset($_POST['Comcast_digital_radio'])){ $Comcast_digital_radio = "n/a"; }else{ $Comcast_digital_radio = $_POST['Comcast_digital_radio']; } // get wireless_internet if(!isset($_POST['wireless_internet'])){ $wireless_internet = "n/a"; }else{ $wireless_internet = $_POST['wireless_internet']; } // get wireless_mic if(!isset($_POST['wireless_mic'])){ $wireless_mic = "n/a"; }else{ $wireless_mic = $_POST['wireless_mic']; } // get laptop if(!isset($_POST['laptop'])){ $laptop = "n/a"; }else{ $laptop = $_POST['laptop']; } // get podium if(!isset($_POST['podium_w_mic'])){ $podium_w_mic = "n/a"; }else{ $podium_w_mic = $_POST['podium_w_mic']; } // get white_board if(!isset($_POST['white_board'])){ $white_board = "n/a"; }else{ $white_board = $_POST['white_board']; } // get keyboard if(!isset($_POST['keyboard'])){ $keyboard = "n/a"; }else{ $keyboard = $_POST['keyboard']; } // get stage if(!isset($_POST['stage'])){ $stage = "n/a"; }else{ $stage = $_POST['stage']; } // get dance_floor if(!isset($_POST['dance_floor'])){ $dance_floor = "n/a"; }else{ $dance_floor = $_POST['dance_floor']; } // get questions if(!empty($_POST['Contact_name'])){ $Questions_or_comments = htmlentities($_POST['Questions_or_comments']); }else{ $Questions_or_comments = "They didnt enter a any questions or comments"; } // get i_understand if(!isset($_POST['Agreement'])){ $Agreement = "n/a"; }else{ $Agreement = $_POST['Agreement']; } //$message = $_POST['message']; //build message prior to send mail $message = "Drake Centre Event Form.\n\n"; $message .= "Name: $Name\n\n"; $message .= "Address: $Address\n\n"; $message .= "Phone_number: $Phone_number\n\n"; $message .= "Cell_number: $Cell_number\n\n"; $message .= "Email: $Email\n\n"; $message .= "Event_date: $Event_date\n\n"; $message .= "Event_time: $Event_time\n\n"; $message .= "Attendance: $Attendance\n\n"; $message .= "banquet: $banquet\n\n"; $message .= "both: $both\n\n"; $message .= "bar: $bar\n\n"; $message .= "Contact_name: $Contact_name\n\n"; $message .= "Phone_number: $Phone_number\n\n"; $message .= "DVD: $DVD\n\n"; $message .= "VHS: $VHS\n\n"; $message .= "built-in_screen: $built_in_screen\n\n"; $message .= "built-in_projector: $built_in_projector\n\n"; $message .= "cable_TV: $cable_TV\n\n"; $message .= "Comcast_digital_radio: $Comcast_digital_radio\n\n"; $message .= "wireless_internet: $wireless_internet\n\n"; $message .= "wireless_mic: $wireless_mic\n\n"; $message .= "laptop: $laptop\n\n"; $message .= "podium_w/mic: $podium_w_mic\n\n"; $message .= "white_board: $white_board\n\n"; $message .= "keyboard: $keyboard\n\n"; $message .= "stage: $stage\n\n"; $message .= "dance_floor: $dance_floor\n\n"; $message .= "Questions or comments?: $Questions_or_comments\n\n"; $message .= "Agreement: $Agreement\n\n"; //$email_from = 'yourname@yourwebsite.com'; $email_from = 'contact@drakecentre.com'; $email_subject = "Drake Centre Event Form"; $email_body = "You have received a new message from the user $Name.\n". "Here is the message:\n $message". //$visitor_email = $_POST['email']; // sending email $email_to = "contact@drakecentre.com"; $headers = "From: $email_from \r\n"; $headers .= "Reply-To: $Email \r\n"; //sends an email message to the address contained in $to, with the subject line contained in $email_subject, and the message contents is whatever is in the variable $email_body //mail($to,$email_subject,$email_body,$headers); //mail($to,$email_subject,$message,$headers); @mail($email_to, $email_subject, $email_body, $headers); } ?> </body> </html> index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Adobe GoLive" /> <link href="drake_d.ico" rel="shortcut icon" /> <title>Drake Centre Contact</title> <link href="http://www.drakecentre.com/css/basic.css" rel="stylesheet" type="text/css" media="all" /> <csscriptdict import="import"> <script type="text/javascript" src="http://www.drakecentre.com/GeneratedItems/CSScriptLib.js"></script> <script src="http://www.drakecentre.com/SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> <script src="http://www.drakecentre.com/SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <script src="http://www.drakecentre.com/SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script> </csscriptdict> <csactiondict> <script type="text/javascript"><!-- var preloadFlag = false; function preloadImages() { if (document.images) { pre_home_ro = newImage('http://www.drakecentre.com/images/navigation/home_ro.gif'); pre_contact_ro = newImage('http://www.drakecentre.com/images/navigation/contact_ro.gif'); pre_location_ro = newImage('http://www.drakecentre.com/images/navigation/location_ro.gif'); pre_menu_ro = newImage('http://www.drakecentre.com/images/navigation/menu_ro.gif'); pre_accommodations_ro = newImage('http://www.drakecentre.com/images/navigation/accommodations_ro.gif'); preloadFlag = true; } } // --></script> </csactiondict> <csimport user="navigation_comp.html" occur="23"> <csactions> <csaction name="3dc7ce6f0" class="Goto Link" type="onevent" val0="accommodations.html" val1="" urlparams="1"></csaction> <csaction name="3dc819ef1" class="Goto Link" type="onevent" val0="menu.html" val1="" urlparams="1"></csaction> <csaction name="3dc8a3e02" class="Goto Link" type="onevent" val0="location.html" val1="" urlparams="1"></csaction> <csaction name="3dc934a63" class="Goto Link" type="onevent" val0="contact.html" val1="" urlparams="1"></csaction> <csaction name="5cef216b1" class="Goto Link" type="onevent" val0="index.html" val1="" urlparams="1"></csaction> </csactions> <csactiondict> <script type="text/javascript"><!-- CSAct[/*CMP*/ '3dc7ce6f0'] = new Array(CSGotoLink,/*URL*/ 'accommodations.html',''); CSAct[/*CMP*/ '3dc819ef1'] = new Array(CSGotoLink,/*URL*/ 'menu.html',''); CSAct[/*CMP*/ '3dc8a3e02'] = new Array(CSGotoLink,/*URL*/ 'location.html',''); CSAct[/*CMP*/ '3dc934a63'] = new Array(CSGotoLink,/*URL*/ 'contact.html',''); CSAct[/*CMP*/ '5cef216b1'] = new Array(CSGotoLink,/*URL*/ 'index.html',''); // --></script> </csactiondict> </csimport> <style type="text/css"> <!-- body { margin-top: 5px; } --> </style> <link href="http://www.drakecentre.com/SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /> <link href="http://www.drakecentre.com/SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> <link href="http://www.drakecentre.com/SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- #apDiv1 { position:absolute; left:291px; top:254px; width:388px; height:14px; z-index:7; visibility: visible; } #apDiv1 strong { font-family: Arial, Helvetica, sans-serif; } #apDiv2 { position:absolute; width:242px; height:251px; z-index:6; left: 17px; top: 263px; } #apDiv2 { font-family: Arial, Helvetica, sans-serif; } #apDiv2 { font-size: 12px; } --> </style> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="MM_preloadImages('../images/navigation/home_h.gif','../images/navigation/accommodations_h.gif','../images/navigation/testimonials_h.gif','../images/navigation/location_h.gif','../images/navigation/contact_h.gif',)"> <div style="position:relative;width:740px;height:580px;background-color:#000;margin:auto;-adbe-g:p,5,5;"> <div style="position:absolute;top:1px;left:1px;width:738px;height:578px;"> <div style="position:relative;width:738px;height:578px;background-color:#fff;-adbe-g:p,5,5;"> <div style="position:absolute; top:4px; left:4px; width:730px; height:246px; visibility: visible;"> <div style="position:absolute;top:270px;left:20px;width:255px;height:150px;-adbe-c:c"> <div align="left"> <!--<font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Contact the Drake Centre today to set-up<br /> a personal tour and meeting.<br /> </font>--> </div> <div text-align="left"> <p style="margin-bottom:-12px;"><font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">802 West Drake Road</font></p> <p><font size="2" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">Fort Collins, Colorado 80526</font></p> <p><font size="6" face="Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">970.492.6473<br /></font></p> <a href="mailto:contact@drakecentre.com">contact@drakecentre.com</a> </div> </div> <div style="position:absolute;top:470px;left:15px;width:139px;height:50px;"> <a href="index.html"><img src="images/drake_centre_sm.gif" alt="" border="0" /></a></div> <!-- <div id="apDiv1"><strong>Request Form </strong></div> --> <div style="position:relative;width:730px;height:246px;background-color:#000;-adbe-g:p,5,5;"> <div style="position:absolute; top:80px; left:5px; width:140px; height:140px; z-index: 1;"> <img src="images/dance_floor.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:0px; left:7px; width:575px; height:80px; z-index: 2;"> <img src="images/contact.gif" alt="" height="80" border="0" /></div> <div style="position:absolute; top:80px; left:150px; width:140px; height:140px; z-index: 3;"> <img src="images/croud.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:80px; left:295px; width:140px; height:140px; z-index: 4;"><img src="images/exterior.gif" alt="" height="140" width="140" border="0" /></div> <div style="position:absolute; top:80px; left:440px; width:140px; height:140px; z-index: 5;"><img src="images/interior.gif" alt="" height="140" width="140" border="0" /></div> </div> </div> <div style="position:absolute;top:531px;left:4px;width:730px;height:42px;"> <div style="position:relative;width:730px;height:42px;background-color:#000;-adbe-g:p,5,5;"><!-- #BeginLibraryItem "/Library/drake_navigation.lbi" --> <script type="text/javascript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <table border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td width="20"> </td> <td><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/navigation/home_h.gif',1)"><img src="images/navigation/home.gif" alt="Home" name="Home" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="accommodations.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Accommodations','','images/navigation/accommodations_h.gif',1)"><img src="images/navigation/accommodations.gif" alt="Accommodations" name="Accommodations" width="108" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="location.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Location','','images/navigation/location_h.gif',1)"><img src="images/navigation/location.gif" alt="Location" name="Location" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/line_spacer.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> <td><a href="contact.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Contact','','images/navigation/contact_h.gif',1)"><img src="images/navigation/contact.gif" alt="Contact" name="Contact" width="54" height="40" border="0" /></a></td> <td><img src="images/navigation/navigation_bar_01.gif" width="18" height="40" alt="line_spacer" longdesc="images/navigation/line_spacer.gif" /></td> </tr> </table> <!-- #EndLibraryItem --></div> </div> <div style="position:absolute; top:262px; left:284px; width:431px; height:90px; -adbe-c:c"> <form action="contact_script.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" >Contact Info</li> <li class="TabbedPanelsTab" >Event Into</li> <li class="TabbedPanelsTab" >Additional Info<br /> </li> <li class="TabbedPanelsTab" >Submit<br /> </li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"> <p><span id="sprytextfield2"> <label>Name <input name="Name" type="text" id="Name" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprytextfield3"> <label>Address <input name="Address" type="text" id="Address" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprytextfield4"> <label>Phone number <input name="Phone_number" type="text" id="Phone number" size="15" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span class="textfieldInvalidFormatMsg">Invalid format.</span> <span id="sprytextfield5"> <label>Cell number <input name="Cell_number" type="text" id="Cell number" size="15" /> </label> <span class="textfieldRequiredMsg">A value is required.</span> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p> <p><span id="sprytextfield6"> <label>Email address <input name="Email" type="text" id="Email" size="40" /> </label> <span class="textfieldRequiredMsg">A value is required.</span> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span><br /><br /><span style="color: #30F;">Sorry this form in development, please call or email for information.</span></p> </div> <!-- begin event info tab--> <div class="TabbedPanelsContent"> <p><span id="sprytextfield7"> <label>Event date <input name="Event_date" type="text" id="Event date" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield9"> <label>Event time <input name="Event_time" type="text" id="Event time" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield8"><label>Attendance <input name="Attendance" type="text" id="Attendance" size="7" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></p> <p><span id="sprycheckbox1"> <label> Event location, rooms are available from 6:00 a.m.-12:00 a.m. <em>(check all that apply)</em><br /> <input name="banquet" type="checkbox" id="room1" value="banquet" /> Banquet Room (East or West, capacity 300) <input name="both" type="checkbox" id="room2" value="both" /> Both Rooms (capacity 550) <input name="bar" type="checkbox" id="room3" value="bar" /> Bar Area (capacity 50) </label></span></p> <p><span id="sprytextfield11"> <label>Contact name (day of event) <input name="Contact_name" type="text" id="Contact name" size="40" /> </label></span></p> <p><span id="sprytextfield12"> <label>Phone number <input name="Phone_number" type="text" id="Phone number" size="15" /> </label> <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p> </div> <!-- begin additional info tab--> <div class="TabbedPanelsContent"> <p><span id="sprycheckbox2"> <label> Electronic equipment needed, no extra charge <em>(check all that apply)</em><br /> <input name="DVD" type="checkbox" id="equipment1" value="DVD" /> DVD <input name="VHS" type="checkbox" id="equipment2" value="VHS" /> VHS <input name="built_in_screen" type="checkbox" id="equipment3" value="built-in screen" /> built-in screen <input name="built_in projector" type="checkbox" id="equipment4" value="built-in projector" /> built-in projector <input name="cable_TV" type="checkbox" id="equipment5" value="cable TV" /> cable TV <input name="Comcast_digital_radio" type="checkbox" id="equipment6" value="Comcast digital radio" /> Comcast digital radio <input name="wireless_internet" type="checkbox" id="equipment7" value="wireless internet" /> wireless internet <input name="wireless_mic" type="checkbox" id="equipment8" value="wireless mic" /> wireless mic <input name="laptop" type="checkbox" id="equipment9" value="laptop" /> laptop <br /> <input name="podium_w_mic" type="checkbox" id="equipment10" value="podium w/mic" /> podium w/mic <input name="white_board" type="checkbox" id="equipment11" value="white board" /> white board <input name="keyboard" type="checkbox" id="equipment12" value="keyboard" /> piano-quality keyboard <br /><br /> </label><label> Additional hardware, fees apply <em>(check all that apply)</em><br /> <input name="stage" type="checkbox" id="equipment13" value="stage" /> stage <input name="dance_floor" type="checkbox" id="equipment14" value="dance floor" /> dance floor </label></span></p> <p><span> <label>Questions or comments?<br /> <textarea name="Questions_or_comments" id="Questions or comments?" cols="45" rows="2"></textarea> </label> </span></p> </div> <!-- begin submit tab--> <div class="TabbedPanelsContent"> <p><span><span id="sprycheckbox3"> <label> <input name="Agreement" type="checkbox" id="Agreement" value="I understand and agree to be contacted" /> I understand that the information I have provided is for the sole use of Drake Centre and is<em><strong> only for an event request</strong></em>. The Drake Centre Event Coordinator will contact me to confirm date availablility and details of event.</label> <span class="checkboxRequiredMsg">Please make a selection.</span></span></span></p> <p><span> <label> <!--For immediate help please contact 970-492-6473, <br /> 7:00 a.m. – 2:00 p.m. Monday through Friday.<br /> <br />--> <input type="submit" name="Submit" id="submit" value="Submit" /> </label> </span> <span style="color: #30F;">Sorry this form in development, please call or email for information.</span></p> </div> </div> </div> <p> </p> <p> </p> <p> </p> </form> </div> </div> </div> </div><!-- #BeginLibraryItem "/Library/drake_footer.lbi" --><style type="text/css"> <!-- #copyright { text-align: right; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #919191; } .footer { text-align: right; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #919191; } --> </style> <table width="740" border="0" align="center"> <tr> <td width="733" class="footer">© 2014 Drake Centre | Photo contributions courtesy of Craig Vollmer Photography</td> </tr> </table> <!-- #EndLibraryItem --><script type="text/javascript"> <!-- var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["change"]}); var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {isRequired:false, validateOn:["change"]}); var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "phone_number", {hint:"(000) 000-0000", validateOn:["change"]}); var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "phone_number", {hint:"(000) 000-0000", isRequired:false, validateOn:["change"]}); var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "email", {validateOn:["change"]}); var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "none", {isRequired:false, validateOn:["change"]}); var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "none", {validateOn:["change"]}); var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9", "none", {validateOn:["change"]}); var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11", "none", {validateOn:["change"]}); var sprytextfield12 = new Spry.Widget.ValidationTextField("sprytextfield12", "phone_number", {hint:"(000) 000-0000", validateOn:["change"]}); var sprycheckbox1 = new Spry.Widget.ValidationCheckbox("sprycheckbox1", {maxSelections:3, minSelections:1}); var sprycheckbox2 = new Spry.Widget.ValidationCheckbox("sprycheckbox2", {maxSelections:14, minSelections:1}); var sprycheckbox3 = new Spry.Widget.ValidationCheckbox("sprycheckbox3"); //--> </script> </body> </html> 1 Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1495317 Share on other sites More sharing options...
newatthis123 Posted April 14, 2015 Author Share Posted April 14, 2015 Just getting back to this project, want to thank everyone for your help. Email message is returned with values even if box is not checked. How can I code this so only the checked boxes and form fields that are filled out come back in the email message? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Contact Form</title> </head> <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <?php ini_set("display_errors", "1"); error_reporting(-1); if($_POST['Submit'] == "Submit") { // get name if(!empty($_POST['Name'])){ $Name = htmlentities($_POST['Name']); }else{ $Name = "They didnt enter a name"; } // get address if(!empty($_POST['Address'])){ $Address = htmlentities($_POST['Address']); }else{ $Address = "They didnt enter an address"; } // get phone_number if(!empty($_POST['Phone_number'])){ $Phone_number = htmlentities($_POST['Phone_number']); }else{ $Phone_number = "They didnt enter a phone number"; } // get cell_number if(!empty($_POST['Cell_number'])){ $Cell_number = htmlentities($_POST['Cell_number']); }else{ $Cell_number = "They didnt enter a cell number"; } // get email_address if(!empty($_POST['Email'])){ $Email = htmlentities($_POST['Email']); }else{ $Email = "They didnt enter an email"; } // get event_date if(!empty($_POST['Event_date'])){ $Event_date = htmlentities($_POST['Event_date']); }else{ $Event_date = "They didnt enter an event date"; } // get event_time if(!empty($_POST['Event_time'])){ $Event_time = htmlentities($_POST['Event_time']); }else{ $Event_time = "They didnt enter an event time"; } // get attendance if(!empty($_POST['Attendance'])){ $Attendance = htmlentities($_POST['Attendance']); }else{ $Attendance = "They didnt enter an attendance"; } // get east_and_west_banquet_rooms_with_bar if(!isset($_POST['East_and_West_Banquet_Rooms_with_Bar'])){ $East_and_West_Banquet_Rooms_with_Bar = "n/a"; } else{ $East_and_West_Banquet_Rooms_with_Bar = $_POST['East_and_West_Banquet_Rooms_with_Bar']; } // get east_and_west_banquet_rooms if(!isset($_POST['East_and_West_Banquet_Rooms'])){ $East_and_West_Banquet_Rooms = "n/a"; }else{ $East_and_West_Banquet_Rooms = $_POST['East_and_West_Banquet_Rooms']; } // get east_banquet_room_with_bar if(!isset($_POST['East_Banquet_Room_with_Bar'])){ $East_Banquet_Room_with_Bar = "n/a"; }else{ $East_Banquet_Room_with_Bar = $_POST['East_Banquet_Room_with_Bar']; } // get east_banquet_room if(!isset($_POST['East_Banquet_Room'])){ $East_Banquet_Room = "n/a"; }else{ $East_Banquet_Room = $_POST['East_Banquet_Room']; } // get west_banquet_room if(!isset($_POST['West_Banquet_Room'])){ $West_Banquet_Room = "n/a"; }else{ $West_Banquet_Room = $_POST['West_Banquet_Room']; } // get bar if(!isset($_POST['Bar'])){ $Bar = "n/a"; }else{ $Bar = $_POST['Bar']; } // get contact_name if(!empty($_POST['Contact_name'])){ $Contact_name = htmlentities($_POST['Contact_name']); }else{ $Contact_name = "They didnt enter a contact name"; } // get phone_number if(!empty($_POST['Phone_number'])){ $Phone_number = htmlentities($_POST['Phone_number']); }else{ $Phone_number = "They didnt enter a phone number"; } // get phone_number if(!empty($_POST['Cell_number'])){ $Cell_number = htmlentities($_POST['Cell_number']); }else{ $Cell_number = "They didnt enter a cell number"; } // get dvd if(!isset($_POST['DVD'])){ $DVD = "n/a"; }else{ $DVD = $_POST['DVD']; } // get built-in_projector if(!isset($_POST['built_in_projector'])){ $built_in_projector = "n/a"; }else{ $built_in_projector = $_POST['built_in_projector']; } // get wireless_internet if(!isset($_POST['wireless_internet'])){ $wireless_internet = "n/a"; }else{ $wireless_internet = $_POST['wireless_internet']; } // get wireless_mic if(!isset($_POST['wireless_mic'])){ $wireless_mic = "n/a"; }else{ $wireless_mic = $_POST['wireless_mic']; } // get laptop if(!isset($_POST['laptop'])){ $laptop = "n/a"; }else{ $laptop = $_POST['laptop']; } // get podium if(!isset($_POST['podium_w_mic'])){ $podium_w_mic = "n/a"; }else{ $podium_w_mic = $_POST['podium_w_mic']; } // get keyboard if(!isset($_POST['keyboard'])){ $keyboard = "n/a"; }else{ $keyboard = $_POST['keyboard']; } // get stage if(!isset($_POST['stage'])){ $stage = "n/a"; }else{ $stage = $_POST['stage']; } // get dance_floor if(!isset($_POST['dance_floor'])){ $dance_floor = "n/a"; }else{ $dance_floor = $_POST['dance_floor']; } // get tables if(!isset($_POST['tables'])){ $tables = "n/a"; }else{ $tables = $_POST['tables']; } // get chairs if(!isset($_POST['chairs'])){ $chairs = "n/a"; }else{ $chairs = $_POST['chairs']; } // get questions if(!empty($_POST['Contact_name'])){ $Questions_or_comments = htmlentities($_POST['Questions_or_comments']); }else{ $Questions_or_comments = "They didnt enter a any questions or comments"; } // get i_understand if(!isset($_POST['Agreement'])){ $Agreement = "n/a"; }else{ $Agreement = $_POST['Agreement']; } //$message = $_POST['message']; //build message prior to send mail $message = "Drake Centre Event Form.\n\n"; $message .= "Name: $Name\n\n"; $message .= "Address: $Address\n\n"; $message .= "Phone_number: $Phone_number\n\n"; $message .= "Cell_number: $Cell_number\n\n"; $message .= "Email: $Email\n\n"; $message .= "Event_date: $Event_date\n\n"; $message .= "Event_time: $Event_time\n\n"; $message .= "Attendance: $Attendance\n\n"; $message .= "East_and_West_Banquet_Rooms_with_Bar: $East_and_West_Banquet_Rooms_with_Bar\n\n"; $message .= "East_and_West_Banquet_Rooms: $East_and_West_Banquet_Rooms\n\n"; $message .= "East_Banquet_Room_with_Bar: $East_Banquet_Room_with_Bar\n\n"; $message .= "East_Banquet_Room: $East_Banquet_Room\n\n"; $message .= "West_Banquet_Room: $West_Banquet_Room\n\n"; $message .= "Bar: $Bar\n\n"; $message .= "Contact_name: $Contact_name\n\n"; $message .= "Phone_number: $Phone_number\n\n"; $message .= "DVD: $DVD\n\n"; $message .= "built-in_projector: $built_in_projector\n\n"; $message .= "wireless_internet: $wireless_internet\n\n"; $message .= "wireless_mic: $wireless_mic\n\n"; $message .= "laptop: $laptop\n\n"; $message .= "podium_w/mic: $podium_w_mic\n\n"; $message .= "keyboard: $keyboard\n\n"; $message .= "stage: $stage\n\n"; $message .= "dance_floor: $dance_floor\n\n"; $message .= "tables: $tables\n\n"; $message .= "chairs: $chairs\n\n"; $message .= "Questions or comments?: $Questions_or_comments\n\n"; $message .= "Agreement: $Agreement\n\n"; //$email_from = 'yourname@yourwebsite.com'; $email_from = 'contact@drakecentre.com'; $email_subject = "Drake Centre Event Form"; $email_body = "You have received a new message from the user $Name.\n". "Here is the message:\n $message". //$visitor_email = $_POST['email']; // sending email $email_to = "contact@drakecentre.com"; $headers = "From: $email_from \r\n"; $headers .= "Reply-To: $Email \r\n"; //sends an email message to the address contained in $to, with the subject line contained in $email_subject, and the message contents is whatever is in the variable $email_body //mail($to,$email_subject,$email_body,$headers); //mail($to,$email_subject,$message,$headers); @mail($email_to, $email_subject, $email_body, $headers); } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/291968-need-help-with-php-form-to-email-script/#findComment-1509059 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.