|
Posted by Jonathan N. Little on 12/08/05 16:07
cartoonsmart wrote:
> Hi I got the following script going;
>
> <?php
> $sendTo = "myemail@myemail.com";
> $subject = "My web site reply";
>
> $headers = "From: " . $_POST["name"];
> $headers .= "<" . $_POST["email"] . ">\r\n";
> $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
> $headers .= "Return-Path: " . $_POST["email"];
> $message = $_POST["message"];
> mail($sendTo, $subject, $message, $headers);
> ?>
>
> It's simple and save and I'm not really into php (yet!)...
> However I have a question regarding my script.
> In the Email body/message I receive after the form is filled in and
> submited
> I only see the message - obvousily because of this line $message =
> $_POST["message"]; -
> Now I would like to receive to name and email address in mail
> body/message to.
> How do I go about to achieve this, I've tried the following...
>
> $message = $_POST["name"];
> $message = $_POST["email"];
>
> after I added the above two lines it didn't result in anything.
> Anyone wanna fill me in on how I can put this to work.
> Thank, appreciate it!
>
In a word 'concatenation', need to look up concatenation of strings
$myvar = 'I am this';
echo $myvar; //displays 'I am this'
$myvar = 'I am this';
$myvar = ' and I am that';
echo $myvar; //now displays only ' and I am that'
$myvar = 'I am this';
$myvar .= ' and I am that';
echo $myvar; //now displays 'I am this and I am that'
Also your code is just a strip down example, right? You are not really
doing the code exactly like this:
> $headers = "From: " . $_POST["name"];
> $headers .= "<" . $_POST["email"] . ">\r\n";
if so, stop and do a little research on security...
http://www.google.com/search?hl=en&q=php+security+form+input+to+mail&btnG=Google+Search
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Navigation:
[Reply to this message]
|