Reply to Re: Include with variables - why does this work ?

Your name:

Reply:


Posted by Rik on 01/12/07 11:00

TMN wrote:
> Erwin Moller wrote:
>>> The include works and finds 'displayIncidents.php' instead of
>>> trying
>>> to find 'displayIncidents.php&delete=true' - is this because I used
>>> urlencode ?
>>
>> No, that is simply because your URL contains a few name-value pairs,
>> seperated by &.
>> You extract one of them, as you did, via $_GET["somename"].
>>
>> The URLencoding only make sure that the value you are posting is
>> valid for passing around via url.
>>
>> [GOOD]
>> $url .= "?$name1=".urlencode($value1)."&$name2=".urlendode($value2);
>>
>> This will end up with an url that replaced all naughty characters
>> with url-encoded characters tat are OK to use in an url.
> No more top posting for me !!!!!

Hear, hear! :-)

> Thanks for the explanation - in displayIncidents.php I can do this:
> $showDelete = $_GET["delete"];
> So the php function "include" knows to parse the name-value pairs and
> the url ?

The variables are already parsed at the beginning. All variables in the
scope the include is called in (so global scope if called in global, the
scope of a function if called in that) are available to the included
script.

Furthermore, the $_GET ($_POST/$_SERVER/$_SESSION/$_REQUEST/$_ENV) are
'superglobals', which means you can access them directly from any point in
the script(s), they're always in scope.
--
Rik Wasmus

[Back to original 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

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