[Project_owners] (Possibly stupid) PHP question

Chris Neale cdn at mozdev.org
Mon Mar 22 12:31:35 EST 2004


On Monday 22 Mar 2004 12:24, matthew at mjwilson.demon.co.uk wrote:
> Hi,
>
>   Is it OK if I ask a quick PHP question here? I realise a PHP forum might
> be a better place but I was just wondering whether there were any PHP
> customisations on mozdev.org.
>
>   I'm trying to read parameters from the user's HTTP request, but I'm not
> seeing anything. I've tried
>
> echo $_REQUEST["browser"];
> echo $_GET["browser"];
>
> and
>
> import_request_variables("gP", "rvar_");
> echo $rvar_browser;
>
>   but none of them show anything when I go to URI?browser=mozilla.
>
>   If I call phpinfo() in the page then I don't see anything in $_REQUEST or
> $_GET.
>
>   Any ideas?
>
> Matthew
>


direct GET is not possible due to the templating system, you best bet is 
post-parsing the REQUEST_URI :

if (strpos($_SERVER["REQUEST_URI"], "?")) {
        $QueryString = explode("?", $_SERVER["REQUEST_URI"]);
        $QueryArray = explode("&", $QueryString[1]);
        foreach ($QueryArray as $QueryItem) {
                $QuerySegment = explode("=", $QueryItem);
                $_GET[$QuerySegment[0]] = $QuerySegment[1];
        }
}

[ stolen from clav's database/extensionroom code ]

-- 

cdn

--

Extensions for Mozillan Applications [ http://cdn.mozdev.org/ ]

get Orbit3+1, Orbit Retro and other Mozilla themes from : 
http://themes.mozdev.org/


More information about the Project_owners mailing list