dj-kenpo Posted May 17, 2007 Share Posted May 17, 2007 I know this is a weird question, but bear with me. using $Get_string = $_SERVER['QUERY_STRING']; to receive a query string such as month=may&$day=15&year=2006 so that $Get_string = "month=may&$day=15&year=2006" can I separate the values and turn them into variables? (like a normally would with a url get) $month = "may" $day= "15" etc it would be great to just do $_GET on the url but I'm sending the string as a variable to another script... so i can't just go the easy route. hope this question makes sense thanks, cheers! Quote Link to comment Share on other sites More sharing options...
taith Posted May 17, 2007 Share Posted May 17, 2007 i really dont suggest it... but here http://ca3.php.net/manual/en/function.extract.php Quote Link to comment Share on other sites More sharing options...
dj-kenpo Posted May 17, 2007 Author Share Posted May 17, 2007 why do you not suggest it? Quote Link to comment Share on other sites More sharing options...
taith Posted May 17, 2007 Share Posted May 17, 2007 huge security risk... for example... anybody could type in ?month=12&year=2006&security=1|0|1|1... and if you have a $_SESSION[security], it just got changed to 1|0|1|1, and if you use that way of securing... they then can have full access... or whatnot... Quote Link to comment Share on other sites More sharing options...
dj-kenpo Posted May 17, 2007 Author Share Posted May 17, 2007 ahhh, I see. I just found string parse, so I think that will work. it also seems more secure. do you agree? I think it answers another guys question too... http://ca.php.net/manual/en/function.parse-str.php <?php $str = "first=value&arr[]=foo+bar&arr[]=baz"; parse_str($str); echo $first; // value echo $arr[0]; // foo bar echo $arr[1]; // baz parse_str($str, $output); echo $output['first']; // value echo $output['arr'][0]; // foo bar echo $output['arr'][1]; // baz ?> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted May 17, 2007 Share Posted May 17, 2007 The extract() function is not what the OP needs. The parse_str() function will do what is asked. Ken Quote Link to comment Share on other sites More sharing options...
dj-kenpo Posted May 17, 2007 Author Share Posted May 17, 2007 I feel like an idiot answering my own question. 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.