Jump to content

Convert this little code please?


Robert Elsdon

Recommended Posts

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

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.)

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.