You are here: Re: VAriable not initialized in new version of PHP « PHP Programming Language « IT news, forums, messages
Re: VAriable not initialized in new version of PHP

Posted by Ken Robinson on 04/08/07 13:29

gallasr@post.sk wrote in news:1176042537.275827.15330
@y66g2000hsf.googlegroups.com:

>
> Worked before, not working now.
> http://someUrl/index.php?content=kurzy
>
> Whole navigation is made by different value of variable content.
> Variable is not posted from form. It is just link.
>
> <a href="index.php?content=kurzy">Kurzy</a>
>
> print $content; prints nothing, so it seems that variable is not
> initialized. Why? What have changed between versions 4 and 5 of PHP.

Regsiter_globals used be enabled by default, it is now disabled. Please
read <http://www.php.net/register_globals> for more information. This
setting in the php.ini file controls whether variables on the URL, from
POSTed forms, or in COOKIEs were preset. Now you have to retrieve the
values from the particular superglobal array yourself.

$_GET for forms with method="get" and from variables on the URL
$_POST for forms with method=post"
$_COOKIE
$_SERVER
$_SESSION
$_FILES

So in your case, you need to change the code to read

print $_GET['content'];

Ken

 

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

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