php processor does not seem to work: mail form??
Posted: Wed May 21, 2008 10:51 am
I am trying to write a simple mail form, but when ever the script is processed, nothing is returned, no errors or anything. Is something wrong with my PHP processor or something??
Here is the form and script:
PHP script:
I believe the script should work - do you know what is wrong?
What perplexes me, is that no errors are returned and no echo statements are produced either.
Here is the form and script:
Code: Select all
<form action="mailprocessor.php" method="post">
<fieldset class = "fieldset1">
<legend class = "legend">Contact Form</legend>
<dt class = "dt">Name</dt>
<dd><input class = "text_area" type="text" name="name" maxlength="20" size="20"></dd>
<dt class = "dt">Email:</dt>
<dd><input class = "text_area" type="text" name="email" maxlength="20" size="20"></dd>
<dt class = "dt">Text:</dt>
<dd><textarea class = "text_area" name="comments" font-size= 18px" cols = "40" rows = "5">
</textarea></dd>
<dd><input class = "text_area" type="submit" value="Register" name="submit"></dd>
</fieldset>
</div>
</form>Code: Select all
<?php
$name=$_POST['name'];
$email=$_POST['email'];
$comments=$_POST['comments'];
$submit=$_POST['submit'];
$to = 'josh22x@gmail.com';
$subject = '$name . "Commented on your Blogging site" . "<br>" . "His email address is:" . $email .
"He had this to say:" . $comments';
$message = 'Comment from viewer';
if(isset($name, $email, $comments))
{
$sent = mail($to, $subject, $message);
}
else
{
echo 'Please fill out all of the fields';
}
exit;
if($sent)
{
echo 'Mail sent successfully';
}
else
{
echo 'Mail Error';
}
?>
What perplexes me, is that no errors are returned and no echo statements are produced either.