You are here: Re: Include with variables - why does this work ? « PHP Programming Language « IT news, forums, messages
Re: Include with variables - why does this work ?

Posted by TMN on 01/12/07 13:17

Toby Inkster wrote:
> TMN wrote:
>
> > The include works and finds 'displayIncidents.php' instead of trying
> > to find 'displayIncidents.php&delete=true' - is this because I used
> > urlencode ?
>
> PHP takes a query string, e.g. the part after the question mark in:
>
> http://example.net/foo.php?a=1&b=2&c=3
>
> and splits it up using ampersands (although it can be configured to
> use different characters instead/as well) like this:
>
> a=1
> b=2
> c=3
>
> and then uses these to populate a global array called $_GET, such that:
>
> $_GET['a'] = 1;
> $_GET['b'] = 2;
> $_GET['c'] = 3;
>
> This $_GET array can now be accessed by "foo.php" and used as it likes.
> (foo.php is also able to access the raw, unprocessed query string, but
> this is not usually very useful.)
>
> In your example, statistics.php sees:
>
> $_GET['fileName'] = 'displayIncidents.php';
> $_GET['delete'] = 'true';
>
> so the following code:
>
> $file=$_GET['fileName'];
> echo "Requested File is: ".$file;
> include($file);
>
> works.
>
> --
> Toby A Inkster BSc (Hons) ARCS
> Contact Me ~ http://tobyinkster.co.uk/contact


Thanks again that is a very clear explanation...

Tim
South Africa

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация