Jump to content

Recommended Posts

Hi, Could someone please look at this code and tell me why I get the following error?:

----------
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
---------


<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="content-type"
content="text/html; charset=iso-8859-1" />

<title>RSVP</title>

</head>

<body>

<?php

if (empty($_GET['name']) || !isset($_GET['attendance']))
echo "<p>You must enter your name and specify whether
you will attend! Click your browser's Back button to
return to the RSVP form.</p>";
else if ($_GET['attendance']=="yes"
&& !is_numeric($_GET['guests']))
echo "<p>Please specify the number
of guests who will accompany you! Click your
browser's Back button to return to the RSVP form.</p>;
else {
if ($_GET['attendance']=="yes") {
$YesFile="attending.txt";
if (file_put_contents($YesFile, addslashes($_GET['name'])
. ", " . $_GET['guests'] . "\n", FILE_APPEND))
echo "<p>Thanks for RSVPing! Were looking forward to seeing you!</p>";
else
echo "<p>Cannot save to the $YesFile file.</p>";
}
if ($_GET['attendance']=="no") { //This is line 28
$NoFile = "notattending.txt";
if (file_put_contents($NoFile, addslashes($_GET['name'])
. "\n", FILE_APPEND))
echo "<p>Thanks for RSVP'ing! Sorry you can't make it!</p>";
else
echo "<p>Cannot save to the $NoFile file.</p>";
}
}

?>

</body>

</html>

-----------------------------------

The html file that comes before it, if you need it, is...


<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


<head>

<meta http-equiv="content-type"
content="text/html; charset=iso-8859-1" />

<title>RSVP</title>

</head>

<body>
<h1>Invitation</h1>
<p> You are cordially invited to attend the
celebration of the Andersons' 50th wedding
anniversary on October 15 at 8:00 p.m.</p>

<form action="SendRSVP.php" method="get">

<h2>RSVP</h2>
<p>Name &nbsp; <input type="text" name="name" size="50" /></p>
<p><input type="radio" name="attendance" value="yes" />I will attend &nbsp;</p>
<p><input type="radio" name="attendance" value="no" />I will NOT attend &nbsp;</p>
<p>Number of guests besides myself &nbsp;
<input type="text" name="guests" /></p>
<p><input type= "submit" value=" Send RSVP" /><input type="reset" />
</p></form>

<p><a href="attending.php">See Who's Attending</a><br />
<a href="notattending.php">See Who's Not Attending</a></p


</body>

</html>


I found my error! A quote mark is missing here:

"<p>Please specify the number
of guests who will accompany you! Click your
browser's Back button to return to the RSVP form.</p>;
browser's Back button to return to the RSVP form.</p>[b][!--coloro:red--][span style=\"color:red\"][!--/coloro--]"[!--colorc--][/span][!--/colorc--][/b];

please take the time to look at your own code. paying attention to the color changes in your code in your favorite php editor will clue you in on syntax errors. If you do not use an editor that turns your code different colors, get one.
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.