ASK83 Posted July 31, 2008 Share Posted July 31, 2008 I'm sending multiple values to one $_GET variable but cannot seem to be able to separate each one out to handle every option. What I'm doing is using checkboxes, each sending an "ID" value to the $_GET collection so if multiple boxes are checked I'd have a URL ending somewhat like this... "...&id=1,2,3,4" Now I'm trying to separate each value out do use each individual id on the next display. Link to comment https://forums.phpfreaks.com/topic/117484-help-with-handling-multiple-values-in-one-_get-variable/ Share on other sites More sharing options...
JasonLewis Posted July 31, 2008 Share Posted July 31, 2008 Like so: $get = $_GET['id']; $each = explode(",",$get); foreach($each as $id){ echo $id; //this will loop through each id... } //Or if you know how much will always be passed. echo $each[0]; //will echo 1 echo "<br>".$each[1]; //will echo 2 Link to comment https://forums.phpfreaks.com/topic/117484-help-with-handling-multiple-values-in-one-_get-variable/#findComment-604312 Share on other sites More sharing options...
ASK83 Posted July 31, 2008 Author Share Posted July 31, 2008 Works like a charm! Thanks a ton! Link to comment https://forums.phpfreaks.com/topic/117484-help-with-handling-multiple-values-in-one-_get-variable/#findComment-604318 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.