aebstract Posted November 11, 2006 Share Posted November 11, 2006 php code:[code]<?phpif (isset($_POST['submit'])) {$problem = FALSE;if (empty($_POST['fullname'])) {$problem = TRUE;echo 'Please enter your name<br />';}if (empty($_POST['email'])) {$problem = TRUE;echo 'Please enter your email<br />';}if (empty($_POST['message'])) {$problem = TRUE;echo 'Please enter a message to be sent<br />';}if ($problem == TRUE) {echo 'Your message has been sent!';$body = "thank you for your email, heritage house holidays will reply as quickly as we can.";$body2 = "Message from $_POST['fullname']$_POST['message']phone - $_POST['number']";mail ($_POST['email'], 'Message Sent!', $body, 'From: [email protected]');mail ([email protected], 'Booking Message', $body2, From: $_POST['email']);} else {}echo '<div id="bodyContent"><form action="register.php" method="post">Name:<br /><input type="text" name="fullname" size="20" value="' . $_POST['fullname'] . '" /><br /><br />Email Address:<br /><input type="text" name="fullname" size="20" value="' . $_POST['email'] . '" /><br /><br />Telephone Number:<br /><input type="text" name="number" size="20" value="' . $_POST['number'] . '" /><br /><br />Message:<br /><textarea name="message" rows="5" columns="25"></textarea><input type="text" name="fullname" size="20" value="' . $_POST['email'] . '" /><br /><br /><input type="submit" name="submit" value="Send!" /></form></div>';?>[/code]Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/heritage/public_html/booking.php on line 32 Link to comment https://forums.phpfreaks.com/topic/26888-parse-error/ Share on other sites More sharing options...
fert Posted November 11, 2006 Share Posted November 11, 2006 remove[code]else {}[/code]and in echo you need to change all the ' to " and vice versa Link to comment https://forums.phpfreaks.com/topic/26888-parse-error/#findComment-122948 Share on other sites More sharing options...
aebstract Posted November 11, 2006 Author Share Posted November 11, 2006 I took the else out but that didnt do anything..? I shouldnt need to switch the ' and ", they are being used correctly, no? Link to comment https://forums.phpfreaks.com/topic/26888-parse-error/#findComment-122949 Share on other sites More sharing options...
Monkeymatt Posted November 11, 2006 Share Posted November 11, 2006 These lines:[code]$body2 = "Message from $_POST['fullname']$_POST['message']phone - $_POST['number']";[/code] Should be changed to something more like this:[code]$body2 = "Message from ".$_POST['fullname']."".$_POST['message']."phone - ".$_POST['number'];[/code]As you cannot have arrays where the key is a string used inside of a string or PHP complains. It would also help more if you could point out which line is line 32.Monkeymatt Link to comment https://forums.phpfreaks.com/topic/26888-parse-error/#findComment-122983 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.