Infected-Waffle Posted May 8, 2006 Share Posted May 8, 2006 Is there a way to store multiple variables in 1 $_GET['']?edit: what I mean is, is there a way to make something like:whatever.php/something.php?d0=var1, var2kind of like an array in the url Quote Link to comment https://forums.phpfreaks.com/topic/9328-multiple-items-in-1-_get/ Share on other sites More sharing options...
ober Posted May 8, 2006 Share Posted May 8, 2006 You can pass arrays, yes. Like if you have a bunch of checkboxes, just name them like this: mycheckboxes[]Then in your processing:[code]foreach($_GET['mycheckboxes'] as $key) echo "$key<br>";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/9328-multiple-items-in-1-_get/#findComment-34391 Share on other sites More sharing options...
Infected-Waffle Posted May 8, 2006 Author Share Posted May 8, 2006 It's not check box's. It's like if you click a link it adds it to the url var and keeps it until you end the game (whihc is what this is for.) I need a way to force link colors to change during one game session, so I decided to store the used options in the url and call them from there and add them each time you visit a page.[a href=\"http://www.infected-designs.com/jeopardy/\" target=\"_blank\"]http://www.infected-designs.com/jeopardy/[/a]it's for that, you'll understand when you look at one of the boards.edit:here's the source if you need it...[a href=\"http://www.infected-designs.com/jeopardy/source/\" target=\"_blank\"]http://www.infected-designs.com/jeopardy/source/[/a] Quote Link to comment https://forums.phpfreaks.com/topic/9328-multiple-items-in-1-_get/#findComment-34394 Share on other sites More sharing options...
wildteen88 Posted May 8, 2006 Share Posted May 8, 2006 Yes you can place an array within an array in a ur. Something like this:[code]<?phpif(isset($_GET['say'])){ echo '<pre>' . print_r($_GET['say'], true) . '</pre>';}?><a href="?say['hello']=hello&say['world']=world">Set the array in the url!</a>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/9328-multiple-items-in-1-_get/#findComment-34400 Share on other sites More sharing options...
Infected-Waffle Posted May 8, 2006 Author Share Posted May 8, 2006 [!--quoteo(post=372387:date=May 8 2006, 03:47 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 8 2006, 03:47 PM) [snapback]372387[/snapback][/div][div class=\'quotemain\'][!--quotec--]Yes you can place an array within an array in a ur. Something like this:[code]<?phpif(isset($_GET['say'])){ echo '<pre>' . print_r($_GET['say'], true) . '</pre>';}?><a href="?say['hello']=hello&say['world']=world">Set the array in the url!</a>[/code][/quote]I'm confused. Could you please explain more? Quote Link to comment https://forums.phpfreaks.com/topic/9328-multiple-items-in-1-_get/#findComment-34402 Share on other sites More sharing options...
wildteen88 Posted May 8, 2006 Share Posted May 8, 2006 Basically say['hello'] is an arraysay is the primary array ($_GET['say']) to get the bits in the [] after say you use $_GET['say']['hello'];You are just setting an array within the url.The print_r function in the code supplied shows the contents of the $_GET['say'] array.I haveing arrays within a URL isn't most pleasent thing to see as can become confusing. Quote Link to comment https://forums.phpfreaks.com/topic/9328-multiple-items-in-1-_get/#findComment-34432 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.