EchoFool Posted January 21, 2008 Share Posted January 21, 2008 Is it possible to get check $_GET is set regardless of what type of $_GET is set? So say theres like 10 $_GET urls on one page. Rather than checking one at a time like this:@ if (isset($_GET['test']) OR isset($_GET['test'])) Is there a way to just do if(isset($_GET['wildcard'])) So the wild is to check for anything? =/ Would help shorten my script quite a lot lol Link to comment https://forums.phpfreaks.com/topic/87105-solved-check-get-isset/ Share on other sites More sharing options...
aebstract Posted January 21, 2008 Share Posted January 21, 2008 edit: post beneath me is better Link to comment https://forums.phpfreaks.com/topic/87105-solved-check-get-isset/#findComment-445472 Share on other sites More sharing options...
marcus Posted January 21, 2008 Share Posted January 21, 2008 i see. <?php $get = count($_GET); if($get > 0){ foreach($get AS $name => $value){ echo $name . " has the values of " . $value . "<br>\n"; } }else { echo "There are no valid get parameters in the URL!"; } ?> Link to comment https://forums.phpfreaks.com/topic/87105-solved-check-get-isset/#findComment-445473 Share on other sites More sharing options...
EchoFool Posted January 21, 2008 Author Share Posted January 21, 2008 If(isset($_GET)){ Echo 1; } I tried that but it echo's 1 even if there is not GET. mgallforever - shall give it a go Link to comment https://forums.phpfreaks.com/topic/87105-solved-check-get-isset/#findComment-445479 Share on other sites More sharing options...
marcus Posted January 21, 2008 Share Posted January 21, 2008 eep error in mine. <?php $get = count($_GET); if($get > 0){ foreach($_GET as $name => $value){ echo $name . " has the value of " . $value . "<br>\n"; } }else { echo "There are no valid get parameters in the URL!"; } ?> when my url looks like: http://localhost/test/get.php?1=2&3=4&5=6 my results: 1 has the value of 2 3 has the value of 4 5 has the value of 6 when my url looks like: http://localhost/test/get.php my results: There are no valid get parameters in the URL! Link to comment https://forums.phpfreaks.com/topic/87105-solved-check-get-isset/#findComment-445482 Share on other sites More sharing options...
EchoFool Posted January 21, 2008 Author Share Posted January 21, 2008 Works thankyou! Link to comment https://forums.phpfreaks.com/topic/87105-solved-check-get-isset/#findComment-445483 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.