Page 1 of 1

Cant get PHP form script to work Please Help

Posted: Mon May 03, 2010 2:39 pm
by simon71
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:

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.";
}
}
?>

Re: Cant get PHP form script to work Please Help

Posted: Mon May 03, 2010 3:18 pm
by requinix
Are you sure they support PHP? Doesn't seem to be installed properly.

Re: Cant get PHP form script to work Please Help

Posted: Tue May 04, 2010 1:02 am
by simon71
According to my fasthost dashboard they do??
Doesn't seem to be installed properly
Not sure what you mean by this?? sorry

Simon