Cant get PHP form script to work Please Help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simon71
Forum Newbie
Posts: 2
Joined: Mon May 03, 2010 2:28 pm

Cant get PHP form script to work Please Help

Post 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.";
}
}
?>
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Cant get PHP form script to work Please Help

Post by requinix »

Are you sure they support PHP? Doesn't seem to be installed properly.
simon71
Forum Newbie
Posts: 2
Joined: Mon May 03, 2010 2:28 pm

Re: Cant get PHP form script to work Please Help

Post 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
Post Reply