Jump to content

parse error


aebstract

Recommended Posts

php code:
[code]<?php

if (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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.