i did a php function to format url, i will pass some $_GET variable to it and it will eliminate them from the url, and here's the code:

CODE

<?
$PS = $_SERVER['PHP_SELF'];
$QS = $_SERVER['QUERY_STRING'];
// *** remove undesired parameters from url *** //
function formaturl($remove_me1,$remove_me2,$remove_me3)
{
    global $PS, $QS, $PS_new; //$GET
    if (!strpos($PS, "?") && !empty($QS))
    {
        $QS_new = "?";
        reset($_GET);
        while (list($key,$value) = each($_GET))
        {
            if ($key != $remove_me1 && $key != $remove_me2 && $key != $remove_me3)
            {
                if(strlen($QS_new) > 1) $QS_new .= "&";
                $QS_new .= $key . "=" . $value;
            }
        }
        if (strlen($QS_new) > 1) $PS_new = $PS.$QS_new;
    }
    return $PS_new;
}
// ***************************************** //
?>

any help would be appticated

 

 

 


Reply