PHP Programming

Locked
User avatar
deathagent
Joined: Mon Sep 08, 2003 5:10 pm
Location: Maine
Org Profile

PHP Programming

Post by deathagent » Sat Oct 29, 2005 12:50 am

Considering the URL bar is currently displaying correcty what my problem is maybe someone here can help. I have been in the process of making a website and I can't seem to get my links to work the way I want them to. I'm using PHP to call the "guts" of the page out of a text file but I cannot seem to get my variable to set itself to the name of the file when it is clicked. Here's an example of how my link is formatted:
<a href = "main.php?page=test">Page 1</a>
When this is clicked the variable, $page, should be set equal to "test" but it is not. Does anyone know why this may be or what I'm doing wrong? I know for a fact that the problem is that the variable is not being set when the link is clicked because if I set the variable in the code for the page it works fine.

By the way, I am running Apache 2.0.54(Win32) with PHP 5.0.5.

trythil
is
Joined: Tue Jul 23, 2002 5:54 am
Status: N͋̀͒̆ͣ͋ͤ̍ͮ͌ͭ̔̊͒ͧ̿
Location: N????????????????
Org Profile

Re: PHP Programming

Post by trythil » Sat Oct 29, 2005 3:12 am

deathagent wrote: When this is clicked the variable, $page, should be set equal to "test" but it is not.
NO, IT SHOULD NOT!

That behavior you're relying on is EXTREMELY DANGEROUS. register_globals was turned off by default FOR A GOOD REASON. It should be TRIVIAL to think of a scenario where this would lead to a massive security hole.

If you want to retrieve the components of the query string, use the $_GET associative array.

Locked

Return to “Site Help & Feedback”