Chicken Posted July 19, 2007 Share Posted July 19, 2007 <?php $_GET["s"]; if ($s = 1) { echo "Test1"; } elseif ($s = 2) { echo "Test2"; } echo "Home"; ?> Any help is greatly appreciated, as I'm quite new at this Link to comment https://forums.phpfreaks.com/topic/60713-solved-display-text-if-variable-x-w-multiple-ifs/ Share on other sites More sharing options...
jitesh Posted July 19, 2007 Share Posted July 19, 2007 <?php $s = $_GET["s"]; // or extract($_GET); or register global should be On if ($s == 1) { echo "Test1"; } elseif ($s == 2) { echo "Test2"; } echo "Home"; ?> Link to comment https://forums.phpfreaks.com/topic/60713-solved-display-text-if-variable-x-w-multiple-ifs/#findComment-302025 Share on other sites More sharing options...
teng84 Posted July 19, 2007 Share Posted July 19, 2007 use switch its better switch($_GET["s"]){ case 's': //do somthing break; case 'd': //do somthing break; default: //default avlue break; } Link to comment https://forums.phpfreaks.com/topic/60713-solved-display-text-if-variable-x-w-multiple-ifs/#findComment-302031 Share on other sites More sharing options...
Chicken Posted July 19, 2007 Author Share Posted July 19, 2007 much thanks! Link to comment https://forums.phpfreaks.com/topic/60713-solved-display-text-if-variable-x-w-multiple-ifs/#findComment-302055 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.