SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: parse error
-
Jun 22, 2007, 23:44 #1
- Join Date
- Jun 2007
- Location
- Nairobi, kenya
- Posts
- 4
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
parse error
am new in use of php scripts I got the following error after developing one script
syntax error, unexpected $end in /hsphere/local/home/frankhop/contact.php on line 47
the code is as below;
<?php
if (!isset($_POST['submit_form'])):
$to="my email.com";
$from = $_REQUEST['email'] ;
$name = $_REQUEST['firstname'] ;
$Telephone = $_REQUEST['Telephone'] ;
$Date = $_REQUEST['Date'] ;
$nights= $_REQUEST['nights'] ;
$headers = "From: $from";
$subject = "My Enquiries";
$fields = array();
$fields{"email"} = "Email Address";
$fields{"firstname"} = "First Name";
$fields{"lastname"} = "Last Name";
$fields{"Telephone"} = "Telephone";
$fields{"Date"} = "Arrival Date";
$fields{"nights"} = "No of Nights";
$fields{"Adults"} = "No of Adults";
$fields{"child"} = "No of Children";
$fields{"comments"} = "Your Enquiry";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: imy email.com";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us.
Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at mywebadress.com";
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
if($Tel == '') {print "You have not entered your Telephone Number, please go back and try again";}
else {
if($Date == '') {print "You have not entered the arrival date, please go back and try again";}
else {
if($nights== '') {print "You have not entered Number of Nights, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: http://mywebadress/thankyou.html" );}
else
{print "We encountered an error sending your mail, please notify admin@myemail"; }
}
}
?>
Is there anything I omited?
pls somebody help
-
Jun 22, 2007, 23:54 #2
The last } should be endif;
-
Jun 23, 2007, 00:00 #3
- Join Date
- Dec 2006
- Location
- /dev/swat
- Posts
- 619
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Welcome to forum.
Why u repeat if statement,
use elseif.
-
Jun 23, 2007, 00:10 #4
-
Jun 23, 2007, 00:11 #5
-
Jun 23, 2007, 00:34 #6
- Join Date
- Dec 2006
- Location
- /dev/swat
- Posts
- 619
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
look at ur these lines:
PHP Code:if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
if($Tel == '') {print "You have not entered your Telephone Number, please go back and try again";}
else {
if($Date == '') {print "You have not entered the arrival date, please go back and try again";}
else {
if($nights== '') {print "You have not entered Number of Nights, please go back and try again";}
else {
PHP Code:if($from == '') {print "You have not entered an email, please go back and try again";}
elseif($name == '') {print "You have not entered a name, please go back and try again";}
elseif($Tel == '') {print "You have not entered your Telephone Number, please go back and try again";}
elseif($Date == '') {print "You have not entered the arrival date, please go back and try again";}
elseif($nights== '') {print "You have not entered Number of Nights, please go back and try again";}
else {
-
Jun 23, 2007, 01:40 #7
Bookmarks