Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Php Function To Format Url, i did a php function to format url but it does not work help
adly3000
post Feb 10 2006, 09:30 PM
Post #1


Member [Level 1]
****

Group: Members
Posts: 58
Joined: 31-January 06
Member No.: 17,937



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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Using The / As A Delimiter In The Split Function(2)


 



- Lo-Fi Version Time is now: 24th July 2008 - 06:49 AM