PDA

View Full Version : PHP Auto response



Ryall
August 9th, 2005, 07:01 PM
PLEASE LOOK AT MY LAST POST - I'VE TRIED EVERYTHING AND NOTHING IS WORKING - THIS IS TURNING INTO AN EXTREAM SIT.

Hey guys... PHP is definitly not my strong point, so here's the question:

I have a Flash form that sends a formatted email via a PHP script using this code:

<?
$to = "eamil@gmail.com";
$subject = "Calatrava Form Submission";
$name = $_POST['name'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$hear = $_POST['hear'];
$housingPref = $_POST['housingPref'];
$price = $_POST['price'];

$message = "Form Submitted by: $name \r\n";
$message .= "Address: $address \r\n ";
$message .= "Phone: $phone \r\n";
$message .= "Email: $email \r\n";
$message .= "Where they heard about this project: $hear \r\n";
$message .= "Housing Pref: $housingPref \r\n";
$message .= "Price Range: $price \r\n";
$header = "From: $name <$email>";

mail($to, $subject, $message, $header);

?>



I am wondering how I can modify the code so that it also sends an autoresponse email to the person that submitted the form data?

I've been looking online places, but havent found anything yet (well at least that I understand).

Peace

lbeetles
August 9th, 2005, 07:08 PM
check out this, it may be what your looking for http://www.kirupa.com/forum/showthread.php?t=187762

Jeff Wheeler
August 9th, 2005, 07:10 PM
Simply create another mail line, and switch $to and $header, and put what you want to say in quotes.

hl
August 9th, 2005, 07:15 PM
yep, nokrev got it :D

ahmed
August 9th, 2005, 07:47 PM
Just looking at the code, I think you got it ;)

hl
August 9th, 2005, 09:51 PM
yeah that's fine. the .= operator means add to that string.

for example,
$me = "Harish ";
$me .= "Lall.";

It's not required that you do the .=. you can do it all in one string, but it makes it a little less confusing :D

Ryall
August 10th, 2005, 02:36 AM
ok this sucks :( - really bad for business for me.
this code does not send the second email (it sends the first which processes the form, but no even this short second autorespond!).

Anyone have a clue why? It all seems so illogical to me that it doesnt work which is why I am just sooo frustrated!


<?
$to = "rwalsh@grafikdesigns.com";
$subject = "Calatrava Form Submission";
$name = $_POST['name'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$hear = $_POST['hear'];
$housingPref = $_POST['housingPref'];
$price = $_POST['price'];

$message = "Form Submitted by: $name \r\n";
$message .= "Address: $address \r\n";
$message .= "Phone: $phone \r\n";
$message .= "Email: $email \r\n";
$message .= "Where they heard about this project: $hear \r\n";
$message .= "Housing Pref: $housingPref \r\n";
$message .= "Price Range: $price \r\n";
$header = "From: $name <$email>";

mail($to, $subject, $message, $header);

mail($email, "Fordham Spire", "thanks!", "info@fordhamspire.com");

?>

Peace

hl
August 10th, 2005, 03:04 AM
i don't know, but try this, it's a little boo boo i caught.


<?
$to = "rwalsh@grafikdesigns.com";
$subject = "Calatrava Form Submission";
$name = $_POST['name'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$hear = $_POST['hear'];
$housingPref = $_POST['housingPref'];
$price = $_POST['price'];

$message = "Form Submitted by: $name \r\n";
$message .= "Address: $address \r\n";
$message .= "Phone: $phone \r\n";
$message .= "Email: $email \r\n";
$message .= "Where they heard about this project: $hear \r\n";
$message .= "Housing Pref: $housingPref \r\n";
$message .= "Price Range: $price \r\n";
$header = "From: $name <$email>";

mail($to, $subject, $message, $header);
mail($email, "Fordham Spire", "thanks!", "From: Fordham Spire <info@fordhamspire.com>");

?>

Ryall
August 10th, 2005, 09:55 AM
yeah I got everything working fine now... and it wasnt so much my PHP... it was more my server and the action script sneding the vars to it.

Thanks everyone for your help!!

Peace