Only ever tried to use 1 script - now its broke - 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
dumb&dumber
Forum Newbie
Posts: 1
Joined: Fri Oct 28, 2005 5:33 am

Only ever tried to use 1 script - now its broke - help

Post by dumb&dumber »

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hello all, 

Yes Im a newbie. Iv'e only ever used one php script which is this feedback form. It worked fine for just email & name and have tried to increase the input fields but everything has stopped working. 

The form is located on the index.html page and appears fine. When you submit it either with or without the form filled, it just diverts back to the blank index.html page. 

Ive done the thankyou.html & nogood.html and have read loads of these posts but I dont know what I am doing wrong.


HELP

Code: Select all

<? 
/* 
EDIT THE CONFIGURABLE SECTIONS 

*/ 

// ------------- CONFIGURABLE SECTION ------------------------ 


$mailto = 'dave*********@yahoo.co.uk' ; 

$subject = "Brochure Request" ; 


$formurl = "http://www.sameday*****.co.uk/index.html" ; 
$errorurl = "http://www.sameday*****.co.uk/nogood.html" ; 
$thankyouurl = "http://www.sameday*****.co.uk/thankyou.html" ; 

// -------------------- END OF CONFIGURABLE SECTION --------------- 

$name = $_POST['name'] ; 
$email = $_POST['email'] ; 
$postcode = $_POST['postcode'] ; 
$number = $_POST['number'] ; 
$style = $_POST['style'] ; 
$bedrooms = $_POST['bedrooms'] ; 
$age = $_POST['age'] ; 
$value = $_POST['value'] ; 
$price = $_POST['price'] ; 
$saletime = $_POST['saletime'] ; 


$http_referrer = getenv( "HTTP_REFERER" ); 

if (!isset($_POST['email'])) { 
header( "Location: $formurl" ); 
exit ; 
} 
if (empty($name) || empty($email) || empty($postcode) || empty($number) || empty($style) || empty($bedrooms) || empty($age) || empty($value) || empty($price) || empty($saletime)) { 
header( "Location: $errorurl" ); 
exit ; 
} 
$name = strtok( $name, "\r\n" ); 
$email = strtok( $email, "\r\n" ); 
$postcode = strtok( $postcode, "\r\n" ); 
$number = strtok( $number, "\r\n" ); 
$style = strtok( $style, "\r\n" ); 
$bedrooms = strtok( $bedrooms, "\r\n" ); 
$age = strtok( $age, "\r\n" ); 
$value = strtok( $value, "\r\n" ); 
$price = strtok( $price, "\r\n" ); 
$saletime = strtok( $saletime, "\r\n" ); 
if (get_magic_quotes_gpc()) { 
$comments = stripslashes( $comments ); 
} 

$messageproper = 

"This is a set of property details from:\n" . 
"\n\n" . 
"$http_referrer\n" . 
"\n\n" . 
"----------------------------------------------------------------\n\n" . 
$name . 
"\n\n" . 
$email . 
"\n\n" . 
$postcode . 
"\n\n" . 
$number . 
"\n\n" . 
$style . 
"\n\n" . 
$bedrooms . 
"\n\n" . 
$age . 
"\n\n" . 
$value . 
"\n\n" . 
$price . 
"\n\n" . 
$saletime . 
"\n\n------------------------------------------------------------\n" ; 

mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\nX-Mailer: chfeedback.php 2.04" ); 
header( "Location: $thankyouurl" ); 
exit ; 

?>

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the script requires that $_POST['email'] exist to go beyond redirection back to the index page. Are you using the post method on the form? Have you changed the name of the email field (including case or punctuation)?
Post Reply