- Impact
- 18
I need to remove the variable $m from my querystring... the querystring is variable, and $m is never always in the same place, and never the same variable.
I want to make a link from search.php?m=blah&q=blah2 etc... to search.php?m=something_else_now&q=blah2 < same again. Now, there could potentially be hundreds of variables in my querystring, and $m could be anywhere in there, so I can't just take the first x letters off. Also the value of $m varys in length depending on the the user's preferences.
Is there any way I can take the $m value out of the querystring?
Thanks
Tom
Hey, I put my mind to it, and I got it!
if anyone wants the code: here it is:
$qs_final is the variable that holds the new querystring with your var removed!
I want to make a link from search.php?m=blah&q=blah2 etc... to search.php?m=something_else_now&q=blah2 < same again. Now, there could potentially be hundreds of variables in my querystring, and $m could be anywhere in there, so I can't just take the first x letters off. Also the value of $m varys in length depending on the the user's preferences.
Is there any way I can take the $m value out of the querystring?
Thanks
Tom
Hey, I put my mind to it, and I got it!
if anyone wants the code: here it is:
PHP:
$querystring = explode("&",$_SERVER['QUERY_STRING']);
$qs_nos = 0;
$qs_final = "?";
while(isset($querystring[$qs_nos])){
if(!ereg("m=",$querystring[$qs_nos])){ // change the "m=" to "var_to remove="
$qs_final .= $querystring[$qs_nos]."&";
}
$qs_nos++;
}
$qs_final is the variable that holds the new querystring with your var removed!





