Domo
1
Ive made a flash contact form that interacts with a “form.php” file after you hit “send” on the contact form.
Heres the code:
<html>
<head>
<title>Contact Form</title>
</head>
<body>
<?
$msg .= "Name: ".$_POST["name"]."
";
$msg .= "Email: ".$_POST["email"]."
";
$msg .= "Message: ".$_POST["message"]."
";
$to = "domo@hotmail.com";
$subject = "Email from domo's site".$_POST["subject"];
$mailheaders .= "Reply-To: ".$_POST["email"]."
";
$result = mail($to, $subject, $msg, $mailheaders);
?>
</body>
</html>
When someone uses this form and I receive their email in my outlook express… it always says From: Nobody.
Does anyone know how to change my code so that it is changed from “nobody” to the persons mail who sent it?
Also, I was wondering how to edit my code to make sure that the email I get includes the senders IP address, just in case C:-)
Thanks,
Domo
system
2
try this
<?php
mail($to, $subject, $msg,"From: $_POST['name'] <$_POST['email']>
"."Reply-To: ".$_POST["email"]."
");
?>
and $_SERVER[‘REMOTE_ADDR’] resolves the user’s IP 
system
4
do i add that into my original code or just have that alone?
system
5
<?
$msg .= "Name: ".$_POST["name"]."
";
$msg .= "Email: ".$_POST["email"]."
";
$msg .= "Message: ".$_POST["message"]."
";
$to = "domo@hotmail.com";
$subject = "Email from domo's site".$_POST["subject"];
$mailheaders .= "From: $_POST['name'] <$_POST['email']>
"."Reply-To: ".$_POST["email"]."
";
$result = mail($to, $subject, $msg, $mailheaders);
?>
system
6
^Thanks for that!
Ill try it out and let you know how it goes
system
7
hmm…
This is the error I get:
Parse error: parse error, expecting T_STRING' or
T_VARIABLE’ or `T_NUM_STRING’ in /home/domo/public_html/mx/form.php on line 15
Heres my code:
<?
$msg .= "Name: ".$_POST["name"]."
";
$msg .= "Email: ".$_POST["email"]."
";
$msg .= "Message: ".$_POST["message"]."
";
$to = "domo@hotmail.com";
$subject = "Email from domo's site".$_POST["subject"];
$mailheaders .= "From: $_POST['name'] <$_POST['email']>
"."Reply-To: ".$_POST["email"]."
";
$result = mail($to, $subject, $msg, $mailheaders);
$_SERVER['REMOTE_ADDR']
?>
Think you can help me out?
Thanks 
system
8
i don’t see the purpose of the last line… remove it and it should be fine
system
9
I get the same error when it is removed.
system
10
I rewrote your script… it’s much cleaner now:
<?php
// define variables
$name = $_POST['name'];
$email = $_POST['email'];
$usr_subject = $_POST['subject'];
$message = $_POST['message'];
$IP = $_SERVER['REMOTE_ADDR'];
$to = "domo@hotmail.com";
// set $subject
$subject = "Email from domo's site $usr_subject";
// set $msg
$msg = "Name: $name
Email: $email
IP: $IP
Message: $message";
// define mail headers
$mailheaders = "From: $name <$email>";
$result = mail($to, $subject, $msg, $mailheaders);
?>
the script above i know works, just tested it… if it doesnt work for you, you’re on your own 
system
11
and… why do you set the “reply-to” to be the reciever’s email??
system
12
i dont know - rofl im kind of a noob to PHP but I intend to learn it all 100% :P.
Thanks for your help, its greatly appreciated.