sean14592 Posted May 20, 2008 Share Posted May 20, 2008 HI, Simple error I keep getting but I cant see anything wrong, Please, Please help me. Error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/WEBSITE/public_html/new/index.php on line 23 Code (Lines 19-37): <?php // start the PHP if (isset($_GET['page'])){ // if the variable 'page' is set in the URL do this: if ($_GET['page'] == 'news'){ // if the variable 'page' is equal to 'news' ( /index.php?page=news ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } else if ($_GET['page'] == 'something'){ // if the variable 'page' is equal to 'something' ( /index.php?page=something ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } else if ($_GET['page'] == 'properties'){ // if the variable 'page' is equal to 'properties' ( /index.php?page=properties ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } } else { header( 'Location: '$_PHP['self']'?page=news' ) ; // or something to this extent, I dont think this works out of the HTML <head> tags. } // end the PHP ?> Cheers Sean Quote Link to comment Share on other sites More sharing options...
rhodesa Posted May 20, 2008 Share Posted May 20, 2008 periods for concatenation... header( 'Location: '.$_PHP['self'].'?page=news' ) ; ...but if you want PHP_SELF, you can also just do: header( 'Location: ?page=news' ) ; Quote Link to comment Share on other sites More sharing options...
sean14592 Posted May 20, 2008 Author Share Posted May 20, 2008 cheers but im still getting the first error. cheers sean reston Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted May 20, 2008 Share Posted May 20, 2008 can we see the updated code? Quote Link to comment Share on other sites More sharing options...
revraz Posted May 20, 2008 Share Posted May 20, 2008 Which line is 23 Quote Link to comment Share on other sites More sharing options...
sean14592 Posted May 20, 2008 Author Share Posted May 20, 2008 yep here it is.... <?php // start the PHP if (isset($_GET['page'])){ // if the variable 'page' is set in the URL do this: if ($_GET['page'] == 'news'){ // if the variable 'page' is equal to 'news' ( /index.php?page=news ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } else if ($_GET['page'] == 'something'){ // if the variable 'page' is equal to 'something' ( /index.php?page=something ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } else if ($_GET['page'] == 'properties'){ // if the variable 'page' is equal to 'properties' ( /index.php?page=properties ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } } else { header( 'Location: ?page=news' ) ; // or something to this extent, I dont think this works out of the HTML <head> tags. } // end the PHP ?> Cheers Sean Quote Link to comment Share on other sites More sharing options...
sean14592 Posted May 20, 2008 Author Share Posted May 20, 2008 Line 23 is... echo ("<div id=\"main\"><div id=\"column\"><div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); Cheers Sean Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted May 20, 2008 Share Posted May 20, 2008 i get no syntax error (or any other error) with that code. Quote Link to comment Share on other sites More sharing options...
sean14592 Posted May 20, 2008 Author Share Posted May 20, 2008 hmmm, he is the full page... http://pastebin.com/m361bbea3 Cheers Sean Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted May 20, 2008 Share Posted May 20, 2008 I get this error: Warning: Cannot modify header information - headers already sent by (output started at /Users/lesbrown/Sites/site1/test.php: in /Users/lesbrown/Sites/site1/test.php on line 33 if you use header(), it must be before ANY output to the browser, including HTML. you need to check $_GET['page'] and header() if necessary before you use <!DOCTYPE> Quote Link to comment Share on other sites More sharing options...
sean14592 Posted May 20, 2008 Author Share Posted May 20, 2008 k, new code.... <?php // start the PHP if (isset($_GET['page'])){ // if the variable 'page' is set in the URL do this: if ($_GET['page'] == 'news'){ // if the variable 'page' is equal to 'news' ( /index.php?page=news ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } else if ($_GET['page'] == 'something'){ // if the variable 'page' is equal to 'something' ( /index.php?page=something ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } else if ($_GET['page'] == 'properties'){ // if the variable 'page' is equal to 'properties' ( /index.php?page=properties ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } } else { echo ("hi!"); // or something to this extent, I dont think this works out of the HTML <head> tags. } // end the PHP ?> though, I still dont know how to fix this first error... Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/holiday/public_html/new/index.php on line 23 Cheers Sean Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted May 20, 2008 Share Posted May 20, 2008 i don't have that error. i get this output: hi! Quote Link to comment Share on other sites More sharing options...
sean14592 Posted May 20, 2008 Author Share Posted May 20, 2008 wtf, I have cleared cach and tried in IE and firefox, could it be my host? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted May 20, 2008 Share Posted May 20, 2008 code should be: <?php if(!isset($_GET['page'])){ // if the variable 'page' is set in the URL do this: header('Location: ?page=news'); exit; } ?> <!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" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>TWO-COLUM FIXED LAYOUT WITH FIXED BOXES</title> <style type="text/css"> @import url("main.css"); </style> </head> <body> <div id="pagewrapper"> <div id="header"> </div> <div id="nav"> </div> <?php // start the PHP if ($_GET['page'] == 'news'){ // if the variable 'page' is equal to 'news' ( /index.php?page=news ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } else if ($_GET['page'] == 'something'){ // if the variable 'page' is equal to 'something' ( /index.php?page=something ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } else if ($_GET['page'] == 'properties'){ // if the variable 'page' is equal to 'properties' ( /index.php?page=properties ) then // echo out all the information regarding that page echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); } ?> <div id="footer"> </div> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
revraz Posted May 20, 2008 Share Posted May 20, 2008 Is that really index.php or is it test.php? You sure you are looking at the right file? Quote Link to comment Share on other sites More sharing options...
sean14592 Posted May 20, 2008 Author Share Posted May 20, 2008 ok, sorted, thanks everyone. It was a bug in my ftp client. It wasent re uplaoding. lol cheers sean thanks every1. 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.