synergenius Posted July 29, 2015 Share Posted July 29, 2015 Hello, I am at my wits end trying to get a script to send mail from a form to my email address. It should also log the information into a MySQL database but thus far I haven't seen any positive results. Here is the script and I thank you in advance for any help that you may be able to lend. <?php session_start(); session_register('name'); session_register('email'); $_SESSION['name'] = $_POST['name']; $_SESSION['email'] = $_POST['email']; $_SESSION['phone'] = $_POST['phone']; $_SESSION['phone_1'] = $_POST['phone_1']; $_SESSION['phone_2'] = $_POST['phone_2']; $_SESSION['phone_3'] = $_POST['phone_3']; $_SESSION['startdate'] = $_POST['startdate']; $_SESSION['startdate_1'] = $_POST['startdate_1']; $_SESSION['startdate_2'] = $_POST['startdate_2']; $_SESSION['startdate_3'] = $_POST['startdate_3']; $_SESSION['calendar'] = $_POST['calendar']; $_SESSION['enddate'] = $_POST['enddate']; $_SESSION['enddate_1'] = $_POST['enddate_1']; $_SESSION['enddate_2'] = $_POST['enddate_2']; $_SESSION['enddate_3'] = $_POST['enddate_3']; $_SESSION['calendar_1'] = $_POST['calendar_1']; $_SESSION['checkitems'] = $_POST['checkitems']; $_SESSION['checkitems_1'] = $_POST['checkitems_1']; $_SESSION['checkitems_2'] = $_POST['checkitems_2']; $_SESSION['checkitems_3'] = $_POST['checkitems_3']; $_SESSION['checkitems_4'] = $_POST['checkitems_4']; $_SESSION['checkitems_5'] = $_POST['checkitems_5']; $_SESSION['checkitems_6'] = $_POST['checkitems_6']; $_SESSION['checkitems_7'] = $_POST['checkitems_7']; $_SESSION['checkitems_8'] = $_POST['checkitems_8']; $_SESSION['projectdescrip'] = $_POST['projectdescrip']; $_SESSION['projectdescrip_1'] = $_POST['projectdescrip_1']; $_SESSION['existingsite'] = $_POST['existingsite']; $_SESSION['formdata'] = $_POST['formdata']; ?> <?php session_start(); $insert_query = 'insert into benjamin_WebDesignForm( name, email, phone, phone_1, phone_2, phone_3, startdate, startdate_1, startdate_2, startdate_3, calendar, enddate, enddate_1, enddate_2, enddate_3, calendar_1, checkitems, checkitems_1, checkitems_2, checkitems_3, checkitems_4, checkitems_5, checkitems_6, checkitems_7, checkitems_8, projectdescrip, projectdescrip_1, existingsite, formdata ) values ( " . $_SESSION['name'] . ", " . $_SESSION['email'] . ", " . $_SESSION['phone'] . ", " . $_SESSION['phone_1'] . ", " . $_SESSION['phone_2'] . ", " . $_SESSION['phone_3'] . ", " . $_SESSION['startdate'] . ", " . $_SESSION['startdate_1'] . ", " . $_SESSION['startdate_2'] . ", " . $_SESSION['startdate_3'] . ", " . $_SESSION['calendar'] . ", " . $_SESSION['enddate'] . ", " . $_SESSION['enddate_1'] . ", " . $_SESSION['enddate_2'] . ", " . $_SESSION['enddate_3'] . ", " . $_SESSION['calendar_1'] . ", " . $_SESSION['checkitems'] . ", " . $_SESSION['checkitems_1'] . ", " . $_SESSION['checkitems_2'] . ", " . $_SESSION['checkitems_3'] . ", " . $_SESSION['checkitems_4'] . ", " . $_SESSION['checkitems_5'] . ", " . $_SESSION['checkitems_6'] . ", " . $_SESSION['checkitems_7'] . ", " . $_SESSION['checkitems_8'] . ", " . $_SESSION['projectdescrip'] . ", " . $_SESSION['projectdescrip_1'] . ", " . $_SESSION['existingsite'] . ", " . $_SESSION['formdata'] . " );' mysql_query($insert_query); ?> <?php $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $phone1 = $_POST['phone_1']; $phone2 = $_POST['phone_2']; $phone3 = $_POST['phone_3']; $startdate = $_POST['startdate']; $startdate1 = $_POST['startdate_1']; $startdate2 = $_POST['startdate_2']; $startdate3 = $_POST['startdate_3']; $calendar = $_POST['calendar']; $enddate = $_POST['enddate']; $enddate1 = $_POST['enddate_1']; $enddate2 = $_POST['enddate_2']; $enddate3 = $_POST['enddate_3']; $calendar1 = $_POST['calendar_1']; $checkitems = $_POST['checkitems']; $checkitems1 = $_POST['checkitems_1']; $checkitems2 = $_POST['checkitems_2']; $checkitems3 = $_POST['checkitems_3']; $checkitems4 = $_POST['checkitems_4']; $checkitems5 = $_POST['checkitems_5']; $checkitems6 = $_POST['checkitems_6']; $checkitems7 = $_POST['checkitems_7']; $checkitems8 = $_POST['checkitems_8']; $projectdescrip = $_POST['projectdescrip']; $projectdescrip_1 = $_POST['projectdescrip_1']; $existingsite = $_POST['existingsite']; $formdata = $_POST['formdata']; $to = "zenslinger@gmail.com"; $subject = "Excuse me boss, there's a message about web design from Zenslinger"; $headers = "From: $email/n"; $message = "An interested party is down with some Zenslinger design work.;/n Name: $name; Email Address: $email; Phone Number: $phone ; Phone Number: $phone_1; Phone Number: $phone_2 Phone Number: $phone_3 Start Date: $startdate Start Date: $startdate_1 Start Date: $startdate_2 Start Date: $startdate_3 Calendar: $calendar End Date: $enddate End Date: $enddate_1 End Date: $enddate_2 End Date: $enddate_3 Calendar: $calendar_1 Check Items: $checkitems Check Items: $checkitems_1 Check Items: $checkitems_2 Check Items: $checkitems_3 Check Items: $checkitems_4 Check Items: $checkitems_5 Check Items: $checkitems_6 Check Items: $checkitems_7 Check Items: $checkitems_8 Project Description: $projectdescrip Project Description: $projectdescrip_1 Existing Site: $existingsite Form Data: $formdata "; mail($to,$subject,$message,$headers); header("Location: http://www.zenslinger.com/Webdesign/thankyou.html"); ?> Quote Link to comment Share on other sites More sharing options...
iarp Posted July 29, 2015 Share Posted July 29, 2015 I would commentout the header('Location: ..') line until it is sending you an email. As well is display_errors = On in your php.ini file? Quote Link to comment 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.