Cant get PHP form script to work Please Help
Posted: Mon May 03, 2010 2:39 pm
Hi,
I cant get my form script to work, im new to PHP so it is probably something simple.
Im hosting with fasthost and when i hit the submit button all that happens is the browser trys to open my PHP page.
Any suggestions?
Please keep it simple if possible im still trying to get my head around PHP.
My script:
I cant get my form script to work, im new to PHP so it is probably something simple.
Im hosting with fasthost and when i hit the submit button all that happens is the browser trys to open my PHP page.
Any suggestions?
Please keep it simple if possible im still trying to get my head around PHP.
My script:
Code: Select all
<?php
$email_to="form@iter-research.co.uk";
$name=$_POST["Name"];
$email_from=$_POST["form@iter-research.co.uk"];
$message=$_POST["Name,Address,Postcode,Email,Gender,Age,Correspondence"];
$email_subject="Consultation Form";
$headers=
"from:$email_from.\n";
"reply-to:$email_from.\n";
if(!filter_var($email_from, FILTER_VALIDATE_EMAIL)) {
die("The email address entered is invalid.");
$message = "Name: ". $name . "\r\nMessage: " . $message;
ini_set("sendmail_from", $email_from);
$sent = mail($email_to, $email_subject, $message, $headers, -f$email_from);
if($sent) {
header("Location: http://www.iter-rese...hank_you.html/");
} else {
echo "There has been an error sending your message. Please try later.";
}
}
?>