I have been trying to write PHP code to create a fully interactive Contact Form for my web site. I have been somewhat successful using different tutorials I have found on line. What I have put together allows the user to enter in their Name, Email, Telephone and Comments. The PHP form then generates a response to the user and Emails me their information. What I am trying to achieve is for the PHP form to generate a response that echos the users input such as "Hello 'User Name'! You have provided us a contact number of '123-456-7890' an email address of 'AnyEmailAddress@yahoo.com'." What I have succeeded in getting is the Email containing the users input sent to my Email address but the automated response to the user just has the tag "Hello" and does not include any of the user inputed info. Can someone please tell me how to correct this. I have looked this up on several tutorials but have not found the answer.
Thank you,
Chris DeCamp
Here is my PHP Code:
<?php
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$comments = $_POST['comments'];
if (!isset($_POST['first_name'])) {
echo "Hello! $first_name";
}
elseif (empty($email) || empty($comments)) {
header( "Location: http://www.ChrisDeCampProductions.com/error.html" );
}
else {
mail( "ChrisDeCamp@ChrisDeCampProductions.com", "Contact Form Results", "$first_name $last_name\n$comments\n$telephone\n$email", "From: $first_name, < $email>" );
header( "Location: http://www.ChrisDeCampProductions.com/phpscripts/sendmail.php" );
}
?>

New Topic/Question
Reply




MultiQuote






|