infophiliac Posted April 28, 2006 Share Posted April 28, 2006 I've been running into the same problem on a number of different pages that I've copied out of the book from which I'm learning PHP. The site for the book doesn't list any corrections to this code, so I assume it's a problem that I'm having and not an error in the book.I'm using PHP v. 4.4.1 on the FreeBSD OS. I'm hosted by Startlogic.com.An example of one that has given me trouble is:[code]if (isset($_POST['interests'])) { $interests = TRUE;} else { $interests = NULL; echo '<p><font color="red">You forgot to enter your interests!</font></p>;}[/code]The error message:Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/wordofno/public_html/learningphp/handle_about.php on line 28Line 28 yere is the first line of quoted code, but nowhere in that line (or any of the subsequent lines) is a semi-colon or comma called for and not used.Any insights would be appreciated. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted April 28, 2006 Share Posted April 28, 2006 Looking at your code it is fine. However I think the error is comming from above line 28. Quote Link to comment Share on other sites More sharing options...
infophiliac Posted April 28, 2006 Author Share Posted April 28, 2006 [!--quoteo(post=369666:date=Apr 28 2006, 03:11 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 28 2006, 03:11 PM) [snapback]369666[/snapback][/div][div class=\'quotemain\'][!--quotec--]Looking at your code it is fine. However I think the error is comming from above line 28.[/quote]Bugger. OK, here's all the body leading up to what I previously posted. [code]<body><?php # Script 2.9 - handle_about.phpif (!empty($_POST['name'])) { $name = stripslashes($_POST['name']);} else { $name = NULL; echo '<p><font color="red">You forgot to enter your name!</font></p>;}if (isset($_POST['interests'])) { $interests = TRUE;} else { $interests = NULL; echo '<p><font color="red">You forgot to enter your interests!</font></p>;}[/code]Everything still look OK? This has occured on every page on which I've tried to use the isset conditional and it's threatening to drive me buggy. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted April 28, 2006 Share Posted April 28, 2006 Just as I though, You have a missing [b]'[/b] on this line:[code] echo '<p><font color="red">You forgot to enter your name!</font></p>;[/code]Notice there is no ' before the ; in the above code. To solve this just put a ' before the ; so you line is like this:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] echo '<p><font color="red">You forgot to enter your name!</font></p>[!--sizeo:3--][span style=\"font-size:12pt;line-height:100%\"][!--/sizeo--][!--coloro:red--][span style=\"color:red\"][!--/coloro--]'[!--colorc--][/span][!--/colorc--][!--sizec--][/span][!--/sizec--];[/quote] Quote Link to comment Share on other sites More sharing options...
infophiliac Posted April 28, 2006 Author Share Posted April 28, 2006 [!--quoteo(post=369670:date=Apr 28 2006, 03:25 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 28 2006, 03:25 PM) [snapback]369670[/snapback][/div][div class=\'quotemain\'][!--quotec--]Just as I though, You have a missing [b]'[/b] on this line:[code] echo '<p><font color="red">You forgot to enter your name!</font></p>;[/code]Notice there is no ' before the ; in the above code. To solve this just put a ' before the ; so you line is like this:[/quote]...and this is why I'm posting on the newbie board. Thanks man! Quote Link to comment 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.