|
Posted by rainer on 03/24/06 17:45
Hi
I'm building a page where users can submit theyr comments and php
$_POST server side variable will collect that information and using mail
function will send it to local user:
html code:
<form action="action.php" method="post">name : <input
name="yname" size="30" type="text"><br>
e-mail : <input name="email" size="40" type="text"><br>
comments : <textarea name="comment" cols="45" rows="6">
</textarea><br>
<br>
<input value="submit" type="submit"></form
and code from action.php:
<?
echo "name:\t", $_POST ['yname'], "<br>";
echo "email:\t", $_POST ['email'], "<br>";
echo " comments:\t", $_POST [ 'comment'], "<br>";
$to = "rainer";
$subject = "comments";
$message = <<<EOF
$_POST [yname];
$_POST [email];
$_POST [ comment];
EOF;
mail($to, $subject, $message);
?>
I get no errors from php but this is what i get to my mailbox:
Array [yname];
Array [email];
Array [ comment];
and echo statements are echoing correct values.
If i remove EOF condition :
$message =
$_POST [yname];
$_POST [email];
$_POST [ comment];
mail($to, $subject, $message);
I will receive correct value but only from [yname] array other values are gone
I know that the version with EOF should mail me values of those arrays
but php is treating them literally for some reason.
I don't get why it is not working, i quess i will call mail function 3 times
to get all values but this is not how it should work.
PHP version is 5.
Rainer
Navigation:
[Reply to this message]
|