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: m155jrt@btinternet.com');
mail (aebstract@gmail.com, '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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.