OK. Can someone please, please tell me what is wrong with my code. It is bugging the hell outta me! Its supposed to send form details to my email address!!
Thanks very much.
<?php
//create short variable names
$name=$HTTP_POST_VARS['name'];
$email=$HTTP_POST_VARS['email'];
$comment=$HTTP_POST_VARS['comment'];
$name= trim($name);
$email= trim($email);
$comment= trim($comment);
if (!$name || !$comment)
{
echo '<h2>Please go back and enter your details.</h2>'
.'<br>The page should redirect back to the form shortly.</br>';
exit;
}
else
{
echo '<h2>Thank you '.$name.' for your feedback</h2>'
.'<br>The page should redirect shortly.</br>';
$toaddress = 'myname@yahoo.ie';
$subject = 'Feedback from Website';
$mailcontent = 'Customer name: '.$name."\n"
.'Customer email: '.$email."\n"
."Customer comments: \n".$feedback."\n";
$fromaddress= "From: $email";
mail($toaddress, $subject, $mailcontent, $fromaddress);
}
?>