From form sender's email included
Posted: Wed Jan 21, 2009 2:25 pm
I have the following php running a form, but it will not, send the form poster's email address in the From section:
HELP - I have tried writing this six ways to sunday - and I'm a bit of a PHP novice
HELP - I have tried writing this six ways to sunday - and I'm a bit of a PHP novice
Code: Select all
<?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'])) ) {
// Checkbox handling
$field_8_opts = $_POST['field_8'][0].",". $_POST['field_8'][1].",". $_POST['field_8'][2].",". $_POST['field_8'][3].",". $_POST['field_8'][4].",". $_POST['field_8'][5].",". $_POST['field_8'][6].",". $_POST['field_8'][7].",". $_POST['field_8'][8];
// Checkbox handling
$field_11_opts = $_POST['field_11'][0].",". $_POST['field_11'][1].",". $_POST['field_11'][2].",". $_POST['field_11'][3].",". $_POST['field_11'][4].",". $_POST['field_11'][5];
$name = $HTTP_POST_VARS['field_18'];
$email = $HTTP_POST_VARS['email'];
$name = stripslashes($name);
$email = stripslashes($email);
$to = 'my@myemailaddress.com';
$subject = 'My Form Submission';
$message = "
First Name: " . $_POST['field_17'] . "
Last Name: " . $_POST['field_18'] . "
Best Number to Reach You: " . $_POST['field_19'] . "
Street Address: " . $_POST['field_20'] . "
City: " . $_POST['field_21'] . "
Postal Code: " . $_POST['field_22'] . "
email: " . $_POST['email'] . "
_______________________________________________
Style of Your Home: " . $_POST['field_1'] . "
Type of Home: " . $_POST['field_2'] . "
Age of Home: " . $_POST['field_3'] . "
# of Bedrooms: " . $_POST['field_4'] . "
# of Bathrooms: " . $_POST['field_5'] . "
Garage: " . $_POST['field_6'] . "
Square Footage: " . $_POST['field_7'] . "
Other Features: $field_8_opts
Other Noteable Features: " . $_POST['field_9'] . "
Where is Your Home Located?: " . $_POST['field_10'] . "
Area Influences: $field_11_opts
Other Area Influences: " . $_POST['field_12'] . "
_________________________________________________________
In Your Opinion, What is The Value of Your Home?: " . $_POST['field_13'] . "
Are You Working With a Realtor?: " . $_POST['field_14'] . "
Do You Need to Sell In Order to Purchase?: " . $_POST['field_15'] . "
What is Your Timeframe to move?: " . $_POST['field_16'];
$header_info = "From: ".$name." <".$email.">";
mail($to, $subject, $message, $header_info);
include("confirm.html");
}
else {
echo "Invalid Captcha String.";
}
?>