Im Jake Posted June 30, 2009 Share Posted June 30, 2009 <body> <?php $toswitch = $_GET['action']; switch($toswitch){ case 'guides': echo "i is cake"; break; case 'test1': break; case 'test2': break; case 'test3': break; default: <center><img src="logo.gif"></center><br /><br /> //logo <center> <b> <div> <a href="index.php">Home</a> | <a href="index.php?action=guides">Guides</a> | <u>More to Come!</u> //Nav </div> </b> </center> <center> <b> <div id="footer"> //Footer <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/3.0/us/80x15.png" /></a><br />This work by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.imjake.info/index.php" property="cc:attributionName" rel="cc:attributionURL">Jake</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/us/">Creative Commons Attribution-Noncommercial 3.0 United States License</a>.<br />Based on a work at <a xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://www.imjake.info/index.php" rel="dc:source">www.imjake.info</a>. </div> </b> </center> break; } ?> </body> Link to comment https://forums.phpfreaks.com/topic/164202-switch-function-what-am-i-doing-wrong/ Share on other sites More sharing options...
kenrbnsn Posted June 30, 2009 Share Posted June 30, 2009 If you don't tell us what errors you're getting, it's a little hard for us to tell you what's wrong, but my best guess is that you're mixing PHP & HTML incorrectly. Ken Link to comment https://forums.phpfreaks.com/topic/164202-switch-function-what-am-i-doing-wrong/#findComment-866174 Share on other sites More sharing options...
Im Jake Posted June 30, 2009 Author Share Posted June 30, 2009 Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/imjake/public_html/index.php on line 33 How do i HTML and PHP the right way? Link to comment https://forums.phpfreaks.com/topic/164202-switch-function-what-am-i-doing-wrong/#findComment-866175 Share on other sites More sharing options...
Im Jake Posted June 30, 2009 Author Share Posted June 30, 2009 Nvm I just defined it and echoed it, if someone knows a better way just tell me. Link to comment https://forums.phpfreaks.com/topic/164202-switch-function-what-am-i-doing-wrong/#findComment-866190 Share on other sites More sharing options...
patrickmvi Posted June 30, 2009 Share Posted June 30, 2009 This part here: default: <center><img src="logo.gif"></center><br /><br /> //logo <center> <b> <div> <a href="index.php">Home</a> | <a href="index.php?action=guides">Guides</a> | <u>More to Come!</u> //Nav </div> </b> </center> <center> <b> <div id="footer"> //Footer <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/3.0/us/80x15.png" /></a><br />This work by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.imjake.info/index.php" property="cc:attributionName" rel="cc:attributionURL">Jake</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/us/">Creative Commons Attribution-Noncommercial 3.0 United States License</a>.<br />Based on a work at <a xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://www.imjake.info/index.php" rel="dc:source">www.imjake.info</a>. </div> </b> </center> break; Should Be: default: ?> <center><img src="logo.gif"></center><br /><br /> //logo <center> <b> <div> <a href="index.php">Home</a> | <a href="index.php?action=guides">Guides</a> | <u>More to Come!</u> //Nav </div> </b> </center> <center> <b> <div id="footer"> //Footer <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/3.0/us/80x15.png" /></a><br />This work by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.imjake.info/index.php" property="cc:attributionName" rel="cc:attributionURL">Jake</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/us/">Creative Commons Attribution-Noncommercial 3.0 United States License</a>.<br />Based on a work at <a xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://www.imjake.info/index.php" rel="dc:source">www.imjake.info</a>. </div> </b> </center> <? break; Link to comment https://forums.phpfreaks.com/topic/164202-switch-function-what-am-i-doing-wrong/#findComment-866336 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.