Hi, have searched this forum and the V3 demo support thread but can't fnd an answer to this question. How do you get the "from" part of the email to be the user's email address (field_2 in my example below)? The example shown in the pinned post seems to only relate to v2.
At the moment the "from" part of the email is the server name and location. I created the form from the V3 demo site and everything else works perfectly.
You did not do a very exhaustive search as there are many posts related to this. Early posts give examples but most refer to online learning sites with specific examples so there is no need for me to keep repeating the same responses.
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/xxxxxx/public_html/Contact/processor.php:1) in /home/xxxxxx/public_html/Contact/processor.php on line 13
And the email still comes "from" the server.
Anyone?????
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, have searched this forum and the V3 demo support thread but can't fnd an answer to this question. How do you get the "from" part of the email to be the user's email address (field_2 in my example below)? The example shown in the pinned post seems to only relate to v2.
At the moment the "from" part of the email is the server name and location. I created the form from the V3 demo site and everything else works perfectly.
here's my code in processor.php
<?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("me@myaddress.com.au","phpFormGenerator - Form submission","Form data:
Your name: " . $_POST['field_1'] . "
Your email address: " . $_POST['field_2'] . "
Your contact number: " . $_POST['field_3'] . "
Your address: " . $_POST['field_4'] . "
How did you find us?: " . $_POST['field_5'] . "
Your service area: " . $_POST['field_6'] . "
Your interest: " . $_POST['field_7'] . "
Message: " . $_POST['field_8'] . "
powered by phpFormGenerator.
");
include("confirm.html");
}
else {
echo "Invalid Captcha String.";
}
?>
You did not do a very exhaustive search as there are many posts related to this. Early posts give examples but most refer to online learning sites with specific examples so there is no need for me to keep repeating the same responses.
Google: "php mail() header"
Top of the list is
http://www.php.net/manual/en/function.mail.php
See example #2.
Thanks - I think....
So I found (again) the code you pointed me to, copied it verbatim into my processor.php file so that it now looks like this:
<?php
$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
session_start();
if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {
mail("me@myaddress.com","phpFormGenerator - Form submission","Form data:
Your name: " . $_POST['field_1'] . "
Your email address: " . $_POST['field_2'] . "
Your contact number: " . $_POST['field_3'] . "
Your address: " . $_POST['field_4'] . "
How did you find us?: " . $_POST['field_5'] . "
Your service area: " . $_POST['field_6'] . "
Your interest: " . $_POST['field_7'] . "
Message: " . $_POST['field_8'] . "
powered by phpFormGenerator.
");
include("confirmation.html");
}
else {
echo "Invalid Captcha String.";
}
?>
And now I get this upon form submission....
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/xxxxxx/public_html/Contact/processor.php:1) in /home/xxxxxx/public_html/Contact/processor.php on line 13
And the email still comes "from" the server.
Anyone?????
First make "session_start();" the first line after "<?php".