I am writing a PHP program to get visitors' feedback:
<?php
$name = $_POST["name"] + "\n";
$email = $_POST["email"] + "\n";
$tel = $_POST["tel"] + "\n";
$msg = $_POST["msg"] + "\n";
$to = "evan@stjudechurch.org.hk";
$from = $_POST["name"];
$from_email_address = $_POST["email"];
$subject = "Message";
$body = $_POST["msg"];
if(mail($to, $subject, $body, $from))
printf("OK");
else
printf("Failed");
?>
However, it fails. What is wrong?
Mail() Problem
Moderator: General Moderators
-
lokhanglee
- Forum Newbie
- Posts: 2
- Joined: Sat Dec 27, 2003 2:23 am
hmm
I tried it on my own. I replaced the $_POST with strings so I didn't have to make my own form....it seemed to work perfectly fine. Maybe you have something else on the page that is hindering your code..
Code: Select all
<?php
$name = $_POSTї"name"] + "\n";
$email = $_POSTї"email"] + "\n";
$tel = $_POSTї"tel"] + "\n";
$msg = $_POSTї"msg"] + "\n";
$to = "wongdesign2k1@yahoo.com";
$from = "wongdesign2k1@yahoo.com";
$from_email_address = "wongdesign2k1@yahoo.com";
$subject = "This is the subject";
$body = "This is the body";
if(mail($to, $subject, $body, $from))
printf("OK");
else
printf("Failed");
?>