park6469
asked on
Confirmation Email - Variable in a PHP mail function?
Hi all! I'm having a strange issue with this code:
The problem is that the second function needs to pull field_8 from the form and send the submitter an email letting them know their email was received.
I can't for the life of me figure out how to make it happen.
Other than that the file works fine. I had been trying this:
But it's not working, I get:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/**********/public_ht ml/signup/ processor. php on line 20
<?php
$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
session_start();
if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {
mail("administrator@domain.com","Signup Request","Customer Data:
Company: " . $_POST['field_1'] . "
Contact Name: " . $_POST['field_2'] . "
Address: " . $_POST['field_3'] . "
City: " . $_POST['field_4'] . "
State: " . $_POST['field_5'] . "
ZIP: " . $_POST['field_6'] . "
Phone Number: " . $_POST['field_7'] . "
E-Mail Address: " . $_POST['field_8'] . "
\nAccount Number: " . $_POST['field_9'] . "
", "From: Web Form");
mail("$customer","Signup Request has been received.","Hello,
This is a confirmation email to notify you that your submission has been received ans is being reviewed by our staff. Please allow up to 3 business days for review.
Thank you.");
include("confirm.html");
}
else {
echo "You did not enter the correct code in the bottom of the form. Please <a href='form.html'>go back</a> and try again.";
}
?>
The problem is that the second function needs to pull field_8 from the form and send the submitter an email letting them know their email was received.
I can't for the life of me figure out how to make it happen.
Other than that the file works fine. I had been trying this:
mail("$_POST['field_8']" . . . . . . .
But it's not working, I get:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,
ASKER
Not quite the answer I am looking for. Disregarding headers, I need that form_8 variable to be passed into a second mail function to email the form submitter letting them know it's been received.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The PHP docs http://us2.php.net/manual/en/function.mail.php say you can put multiple recipients on the same line if you want them to get the same message. I would do it like this:
$to = $_POST['field_8'].','.$customer;
mail($to,"Signup Request has been received.","Hello,...
You code above doesn't have any 'header' information which is required by most SMTP servers to process your mail. It is also checked by the receiving email server and the spam checker they have. You will probably have trouble without it. Look at the header info in my code to see what I'm talking about.
Open in new window