I am just learning PHP. I just tried coding a php script which I saved
as
mail.php
----------------------------
<?
$name=$_POST['name'];
$email=$_POST['email'];
$comments=$_POST['comments'];
$to="pr******@upng.ac.pg";
$message="$name just filled in your comments form. They
said:\n$comments\n\nTheir e-mail address was: $email";
if(mail($to,"Comments From Your Site",$message,"From: $email\n")) {
echo "Thanks for your comments.";
} else {
echo "There was a problem sending the mail. Please check that you
filled in the form correctly.";
}
?>
--------------------------------------------------
and a simple html file called
mailProcess.html
----------------------------------------------
<html>
<head>
<title></title>
</head>
<body>
<h2>Sending Mail using PHP scripting...</h2>
<form action="../mail.php" method="post">
Your Name: <input type="text" name="name"><br>
E-mail: <input type="text" name = "email"><br><br>
Comments<br>
<textarea name="comments"></textarea><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
----------------------------------------------------
which captured data from the user intended for
mail.php
script to process and eventually send an email message to the person
while at the same time display a Thankyou page.
The script is working fine but the question is how do I get the IF part
of the CONDITIONAL statement executed rather than the ELSE part.
Currently it is the ELSE part of the CONDITIONAL statement is being
executed despite me supplying valid email address.
What could be the problem? Should I have installed SEND::Mail or things
like that? I already have PHP 5 and Apache 2 installed on my PC which
runs Windows XP.
jofio