|
Posted by Rik Wasmus on 11/15/07 12:49
On Thu, 15 Nov 2007 06:34:37 +0100, mtuller <mituller@gmail.com> wrote:
> I want to pull part of the URI out to dictate what is pulled from the
> database. For example, I want to control what year data is displayed
> with a url like this: http://www.mysite.com/display.php?year=3D2007
>
> I want to pull out the 2007. I can grab the uri, but what is the best
> way to pull out just the 2007?
$url =3D 'http://www.mysite.com/display.php?year=3D2007';
$querystring =3D parse_url($url,PHP_URL_QUERY);
$querydata =3D array();
parse_str($querystring, $querydata);
if(isset($querydata['year'])) echo "Year is:".$querydata['year'];
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|