I want to set up a form on my site that sends the email to me and send the user to another page, like a confirmation page.How can I do this? Here is my form below:
<?php
$name = $POST['name'];
$email = $POST['email'];
$comments = $POST['comments'];
$user_ip = $SERVER['REMOTE_ADDR'];
$to = 'me@mydomain.com';
$message = "{$name} just filled in your comments form.
They said:\nsite: {$site} \n\n\nemail: {$email} \n\n
ncomments: {$comments} \n\n {$referer} \n\n
Their e-mail address was: {$email} \n\n
IP address is: {$user_ip}
";
if(mail($to,"Comments From Your Site",$message,"From: $email\n"))
{
echo 'Your comments have been sent';
}
else
{
echo 'There was a problem sending this form';
}
?>