Jump to content

Switch Function, What am I doing wrong?


Im Jake

Recommended Posts

<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

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;

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.