Beginner Questions regarding Mail and Forms
| From: | Matthias S. | Date: | Mon, 12 Feb 2007 10:13:57 +0000 |
| Subject: | Beginner Questions regarding Mail and Forms | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-248747@lists.php.net to get a copy of this message | ||
Hi there,
I've got two bloody beginner questions: I've created a form with various
text input fields. One is to hold a numeric value (age). Upon submission, I
try to retrieve the value of this field like this:
$age = $_POST['_txtAge'];
later, I use the $age variable to create a message...
$message = "Name: " . $name . "\n";
$message .= "Email: " .$email . "\n";
$message .= "Age: " . $age . "\n";
$message .= "Gender: " . $gender . "\n";
$message .= "Info: " . $info;
.... then I send the message:
mail("bla@bla.com", "A Request", $message, _getMailHeaders($name, §email));
Now on to my questions:
$message contains the values of all fields correctly except the age field
(input of all others are alphabetic, only age has numeric content). Why is
this?
Secondly, mail sends my message correctly. But the return adresse set in
_getMailHeaders is not used. Instead, some identification from the server is
used. Why is that?
Here the function _getMailHeaders:
function _getMailHeaders($senderName, $senderAddress) {
ini_set(sendmail_from, $senderAddress);
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Reply-To: ' . $senderName .'<'. $senderAddress.
'>' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: PostOffice <postoffice@barkatdogs.com>' . "\r\n";
$headers .= 'From: ' . $senderName . '<' . $senderAddress . '>'
. "\r\n";
ini_restore(sendmail_from);
return $headers;
}
Any help is greatly appreceated.
Matthias