cs1h Posted November 4, 2008 Share Posted November 4, 2008 Hi, I'm trying to make a if statement that does one thing when there is a GET variable present like this www.somesite.com/index.php?thing=1234 and when no GET variable is there (like this www.somesite.com/index.php it does another thing. I tried this but it doesn't work <?php $switch = $_GET["c1"]; if($switch==" "){ echo "Hello Worker"; }else{ echo "Goodbye Worker";} ?> Does anyone know how to do this? Thanks, Colin Link to comment https://forums.phpfreaks.com/topic/131348-solved-help-making-an-if-statement/ Share on other sites More sharing options...
rhodesa Posted November 4, 2008 Share Posted November 4, 2008 if(empty($_GET['thing'])){ echo "There is no GET value"; }else{ echo "There is a GET value: ".$_GET['thing']; } Link to comment https://forums.phpfreaks.com/topic/131348-solved-help-making-an-if-statement/#findComment-682058 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.