Jump to content

Archived

This topic is now archived and is closed to further replies.

weenoid

Can't pass variables in address bar

Recommended Posts


Hey, i've been using PHP for about 3 years and i've hit an odd problem. My server was wiped and the software was re-installed the other day and now my PHP files won't pass variables in the address bar.

Example:
<a href="page.php?id=1">click here</a>

If I click this link it won't pass the variable to page.php even though everything looks fine in the address bar. I've tried everything and can only assume that the problem lies with a setting relating to PHP that must have been altered. Any ideas? Thanks :).

Share this post


Link to post
Share on other sites
Look at your code and see if you are accessing $id or $_GET['id']. I bet the code is probably trying to access it using $id. That will only work with register_globals on. It's best to keep register_globals off and use $_GET superglobal array variable. See:

[a href=\"http://us3.php.net/register_globals\" target=\"_blank\"]http://us3.php.net/register_globals[/a]

Share this post


Link to post
Share on other sites
Well the first one that springs to mind is are you relying on register_globals? If you are you need to change your code so you do not need it.

Share this post


Link to post
Share on other sites

Perfect! Thanks a lot guys. Sorry for asking such a n00b question, but i've never come across this before. Thanks again for the help.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.