harshadmethrath Posted June 2, 2011 Share Posted June 2, 2011 what line of code should i add in order to be able to reply to the sender of contact form. right now its showing the last email created in the server. heres the code <?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); // Checkbox handling $field_1_opts = $_POST['field_1'][0].",". $_POST['field_1'][1]; mail("[email protected]","Invitation - Form submission","Form data: rooms: $field_1_opts First Name: " . $_POST['fname'] . " Last Name: " . $_POST['lname'] . " Your Email: " . $_POST['email'] . " Phone Number: " . $_POST['pnumber'] . " Request your arrival date: " . $_POST['field_2'] . " Request your departure date: " . $_POST['field_3'] . " Please send me an ownership package: " . $_POST['field_4'] . " ",$headers); include ("confirm.html"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/238224-reply-to-sender-contact-form/ Share on other sites More sharing options...
Ollifi Posted June 2, 2011 Share Posted June 2, 2011 You need to use headers. This is working code: <?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); // Checkbox handling $field_1_opts = $_POST['field_1'][0].",". $_POST['field_1'][1]; $headers="Reply-To:".$_POST['email'].""; mail("[email protected]","Invitation - Form submission","Form data: rooms: $field_1_opts First Name: " . $_POST['fname'] . " Last Name: " . $_POST['lname'] . " Your Email: " . $_POST['email'] . " Phone Number: " . $_POST['pnumber'] . " Request your arrival date: " . $_POST['field_2'] . " Request your departure date: " . $_POST['field_3'] . " Please send me an ownership package: " . $_POST['field_4'] . " ",$headers); include ("confirm.html"); ?> Please try, does it work as supposed. Quote Link to comment https://forums.phpfreaks.com/topic/238224-reply-to-sender-contact-form/#findComment-1224196 Share on other sites More sharing options...
fugix Posted June 2, 2011 Share Posted June 2, 2011 you need a reply to header...do you even have any headers to populate the $header var that you are using in your mail() function? Edit: as stated by Ollifi Quote Link to comment https://forums.phpfreaks.com/topic/238224-reply-to-sender-contact-form/#findComment-1224199 Share on other sites More sharing options...
harshadmethrath Posted June 2, 2011 Author Share Posted June 2, 2011 i have not hand coded php. iam using an online service to create it. all i need for this to do is make me reply to the sender. can u include the header that allows that. it would be a great help Quote Link to comment https://forums.phpfreaks.com/topic/238224-reply-to-sender-contact-form/#findComment-1224205 Share on other sites More sharing options...
fugix Posted June 2, 2011 Share Posted June 2, 2011 i have not hand coded php. iam using an online service to create it. all i need for this to do is make me reply to the sender. can u include the header that allows that. it would be a great help ollifi provided that in his/her code Quote Link to comment https://forums.phpfreaks.com/topic/238224-reply-to-sender-contact-form/#findComment-1224214 Share on other sites More sharing options...
harshadmethrath Posted June 2, 2011 Author Share Posted June 2, 2011 it still hasn't changed it... doesn't seem to work Quote Link to comment https://forums.phpfreaks.com/topic/238224-reply-to-sender-contact-form/#findComment-1224219 Share on other sites More sharing options...
harshadmethrath Posted June 2, 2011 Author Share Posted June 2, 2011 if i hit the reply button it replies to the sender. but when iam recieving it.it shows as received from "the last email created in the server" Quote Link to comment https://forums.phpfreaks.com/topic/238224-reply-to-sender-contact-form/#findComment-1224224 Share on other sites More sharing options...
Ollifi Posted June 5, 2011 Share Posted June 5, 2011 What about this: <?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); // Checkbox handling $field_1_opts = $_POST['field_1'][0].",". $_POST['field_1'][1]; $headers="From:".$_POST['email']."\r\nReply-To:".$_POST['email'].""; mail("[email protected]","Invitation - Form submission","Form data: rooms: $field_1_opts First Name: " . $_POST['fname'] . " Last Name: " . $_POST['lname'] . " Your Email: " . $_POST['email'] . " Phone Number: " . $_POST['pnumber'] . " Request your arrival date: " . $_POST['field_2'] . " Request your departure date: " . $_POST['field_3'] . " Please send me an ownership package: " . $_POST['field_4'] . " ",$headers); include ("confirm.html"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/238224-reply-to-sender-contact-form/#findComment-1225376 Share on other sites More sharing options...
harshadmethrath Posted July 25, 2011 Author Share Posted July 25, 2011 hi the reply works fine, but when i recieve the form, it still pulls the last email created in the server. i have attached a jpeg to show [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/238224-reply-to-sender-contact-form/#findComment-1246804 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.