Derleek Posted July 9, 2009 Share Posted July 9, 2009 hello php freaks! Not sure what else to title this topic so... that one will do I am creating an ajax application and i'm wondering the best way to loop through every variable passed via the $_GET[] method. Lets say I have 4 var's that I'm passing in the URL www.example.com/index.php?var1=blah&var2=asdfasdf&pumpkin=true. Is there a built in function to loop through every var passed this way? The only solution I have thought of off the top of my head is to have a variable that contains each of the names that also has a parsing character EX: www.example.com/index.php?varsPassed=var1/var2/pumpkin&var1=blah...etc I haven't tested this method so I am not sure even if the '/' character can be passed as a parsing character. This is my first in-depth ajax application so I'm kinda experimenting with it. Not too sure if even using the 'GET' method is the best option (or even if there are other viable options... haha). I'll be tooling around with this for the next hour or so and i'll post any new angles I dig up on the net. Any and all help is welcome and greatly appreciated. -thanks Quote Link to comment Share on other sites More sharing options...
seventheyejosh Posted July 9, 2009 Share Posted July 9, 2009 foreach($_GET as $key => $value){ echo "Key: $key Value: $value"; echo "<br />"; }//end like so? Quote Link to comment Share on other sites More sharing options...
Derleek Posted July 9, 2009 Author Share Posted July 9, 2009 hahaha. Nice. I figured it would be something that simple Thanks bud, i'll give it a try and report back in a second =) Quote Link to comment Share on other sites More sharing options...
Derleek Posted July 9, 2009 Author Share Posted July 9, 2009 yup. Works perfectly, kinda silly i didn't think of trying that... hahaha 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.