468,306 Members | 1,252 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

VAriable not initialized in new version of PHP

Hello,
>From time to time I maintain simple page in PHP for my friend. After
three years I made upgrade to newest PHP on my local PC and links
stopped to work.
This is the only site I use PHP so I`m just casual user of this
language.

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.

Thanks in advance.
Robert

Apr 8 '07 #1
2 1388
ga*****@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_globalsfor 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
Apr 8 '07 #2
Thank you Ken, You helped me a lot. That was the case/

Robert

Apr 8 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Marcin Vorbrodt | last post: by
3 posts views Thread by paulw | last post: by
15 posts views Thread by Thomas Scheiderich | last post: by
23 posts views Thread by Russ Chinoy | last post: by
2 posts views Thread by Kevin | last post: by
2 posts views Thread by sh.vipin | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.