/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Remove key/value pair from url query string * * @param $qry string Query String * @param $key string Query key to remove * @return string Modified query string * @static */ function removeQueryVal($qry,$qryKey) { $qry_new = ''; { //build query array with removed $key value foreach($qryArr as $val) { //ignore $key query value { $qryval[$qryPair[0]] = $qryPair[1]; } } //rebuild new query string foreach($qryval as $key=>$val) { $qry_new .= '&'.$key.'='.$val; } $qry_new = ($qry_new) ? '?'.$qry_new : ''; } return $qry_new; }