dovetail Posted June 2, 2006 Share Posted June 2, 2006 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><?phpif (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 <input type="text" name="name" size="50" /></p><p><input type="radio" name="attendance" value="yes" />I will attend </p><p><input type="radio" name="attendance" value="no" />I will NOT attend </p><p>Number of guests besides myself <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 numberof guests who will accompany you! Click yourbrowser's Back button to return to the RSVP form.</p>; Quote Link to comment https://forums.phpfreaks.com/topic/11004-parse-error-syntax-error-unexpected-t_encapsed_and_whitespace/ Share on other sites More sharing options...
.josh Posted June 2, 2006 Share Posted June 2, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/11004-parse-error-syntax-error-unexpected-t_encapsed_and_whitespace/#findComment-41100 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.