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 Quote Link to comment Share on other sites More sharing options...
aebstract Posted January 21, 2008 Share Posted January 21, 2008 edit: post beneath me is better Quote Link to comment 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!"; } ?> Quote Link to comment 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 Quote Link to comment 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! Quote Link to comment Share on other sites More sharing options...
EchoFool Posted January 21, 2008 Author Share Posted January 21, 2008 Works thankyou! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.