Robert Elsdon Posted July 4, 2008 Share Posted July 4, 2008 Im ver new and i was wondering if anyone could help me? How do i get a link location? into here? <?php switch ($_GET['page']){ default: echo "Welcome"; break; case "register": echo "Please click <a href="register.php">here</a> to register your free acount."; break; } ?> I tried that code above but it didnt work so can you guys help me fix it to php? echo "Please click <a href="register.php">here</a> to register your free acount."; convert the code above to php for me please. Regards. Link to comment https://forums.phpfreaks.com/topic/113252-convert-this-little-code-please/ Share on other sites More sharing options...
corbin Posted July 4, 2008 Share Posted July 4, 2008 Blah.... Google "php switch." The default branch is always executed if it can be reached, and since it's breaking, it will always say welcome and exit. So, you should put the default case as the last one. (In this situation, I would just put an echo for the welcome outside of the switch, and then I would do the switching.) Link to comment https://forums.phpfreaks.com/topic/113252-convert-this-little-code-please/#findComment-581857 Share on other sites More sharing options...
br0ken Posted July 4, 2008 Share Posted July 4, 2008 <?php switch (strtolower($_GET['page'])) { case "register": echo "Please click <a href=\"register.php\">here</a> to register your free acount."; break; default: echo "Welcome"; break; } ?> Link to comment https://forums.phpfreaks.com/topic/113252-convert-this-little-code-please/#findComment-581912 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.