Kayz Posted May 22, 2012 Share Posted May 22, 2012 Hi guys i have this form working, when somebody fills it out i receive the details fine, however they do not receive an automated response. I must be missing something so basic? Your expertise and help would be much appreciated. <?php //let's start our session, so we have access to stored data session_start(); $receiver = '[email protected]'; $name = 'Submission Form'; $subject = 'Submission Form'; $header = "From: ". $name . " <" . $receiver . ">\r\n"; $fromemail = '[email protected]'; $fromname = 'Submission Form'; $fromsubject = 'Confirmation of Submission Form'; $headers = "From: ". $fromname . " <" . $fromemail . ">\r\n"; $arr= array(); // REMOVAL FROM $arr[0] = " Incident details: \r\n--------------- \n\n"; $arr[1] = "Date of Incident: "; $arr[2] = $_POST['Day']; $arr[3] = " "; $arr[4] = $_POST['Month']; $arr[5] = " "; $arr[6] = $_POST['Year']; $arr[7] = "\n\n Is this date accurate?: "; $arr[8] = $_POST['date_accurate']; $arr[9] = "\n\n Time of incident: "; $arr[10] = $_POST['hour']; $arr[11] = ":"; $arr[12] = $_POST['minute']; $arr[13] = " "; $arr[14] = $_POST['ampm']; $arr[15] = "\n\n Is this time accurate?: "; $arr[16] = $_POST['time_accurate']; $arr[17] = "\n\n First Name: "; $arr[18] = $_POST['Title']; $arr[19] = " "; $arr[20] = $_POST['fname']; $arr[21] = "\n\n Last Name: "; $arr[22] = $_POST['lname']; // REMOVAL TO $arr[23] = "\r\n\r\n\r\n\r\n Victims details: \r\n------------- \n\n"; $arr[24] = "Date of Birth: "; $arr[25] = $_POST['dobDay']; $arr[26] = " "; $arr[27] = $_POST['dobMonth']; $arr[28] = " "; $arr[29] = $_POST['dobYear']; $arr[30] = "\n\n House Name / No.: "; $arr[31] = $_POST['House_Name_No']; $arr[32] = "\n\n Address Line 1: "; $arr[33] = $_POST['Address_Line_1']; $arr[34] = "\n\n Address Line 2: "; $arr[35] = $_POST['Address_Line_2']; $arr[36] = "\n\n Post Code: "; $arr[37] = $_POST['PostCode']; $arr[38] = "\n\n Telephone No.: "; $arr[39] = $_POST['TelephoneNo']; $arr[40] = "\n\n Email Address: "; $arr[41] = $_POST['EmailAddress']; $arr[42] = "\n\n Name of Location: "; $arr[43] = $_POST['iLocationName']; $arr[44] = "\r\n\r\n\r\n\r\n Incident Location: \r\n------------------------------ \n\n"; $arr[45] = "Address Line 1: "; $arr[46] = $_POST['iAddress_Line_1']; $arr[47] = "\n\n Address Line 2: "; $arr[48] = $_POST['iAddress_Line_2']; $arr[49] = "\n\n Town / City: "; $arr[50] = $_POST['iTownCity']; $arr[51] = "\n\n Post Code: "; $arr[52] = $_POST['iPostCode']; $arr[53] = "\n\n Country: "; $arr[54] = $_POST['iCountry']; $arr[55] = "\n\n Incident Details: "; $arr[56] = $_POST['incident_details']; $arr[57] = "\r\n\r\n\r\n\r\n Reporting to the Police: \r\n------------------------------ \n\n"; $arr[58] = "Were the police informed?: "; $arr[59] = $_POST['police_informed']; $arr[60] = "\n\n Date informed: "; $arr[61] = $_POST['PDay']; $arr[62] = " "; $arr[63] = $_POST['PMonth']; $arr[64] = " "; $arr[65] = $_POST['PYear']; $arr[66] = "\n\n Station: "; $arr[67] = $_POST['station']; $arr[68] = "\n\n Station Tel no.: "; $arr[69] = $_POST['stationtel']; $arr[70] = "\n\n Officer Name: "; $arr[71] = $_POST['officername']; $arr[72] = "\n\n Crime no.: "; $arr[73] = $_POST['crimeno']; foreach ($arr as $i => $t) { if ( empty($t) ) { unset($arr[$i-1]); } } $content = implode('', $arr); mail("$receiver", "$subject", stripslashes("$content"), "$header"); header("Location: thankyou.html"); $message2 = " Dear $fname, Thank you for filling out this form and submitting incident details. "; mail("$EmailAddress", "$fromsubject", stripslashes("$message2"), "$headers"); header("Location: thankyou.html"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/262944-everything-works-except-auto-reply/ Share on other sites More sharing options...
mrMarcus Posted May 22, 2012 Share Posted May 22, 2012 Who is who here? And can you post the form as well, please. $receiver is going to you? To the user? It's not being populated by any form information. Where is the code with the user's email address? Something like: $receiver = $_POST['email_address_of_user']; Seems you have omitted a chunk of code, or you are working with an unfinished script. Also, you do not need to set an index for your array if you're just using an incremental integer value. Either just do this: $arr[] = 'stuff here'; $arr[] = 'second line stuff here'; // cont... Also, you do not need to wrap your PHP variables in double-quotes all the time. For example, the following will produce identical results: mail("$receiver", "$subject", stripslashes("$content"), "$header"); // how you have it AND mail($receiver, $subject, stripslashes($content), $header); // same thing, minus all the double-quotes Quote Link to comment https://forums.phpfreaks.com/topic/262944-everything-works-except-auto-reply/#findComment-1347712 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.