Jump to content

Reply to sender ( contact form )


Recommended Posts

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");

 

?>

Link to comment
https://forums.phpfreaks.com/topic/238224-reply-to-sender-contact-form/
Share on other sites

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.

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"); 

?>

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.