Jump to content


Can't pass variables in address bar

  • Please log in to reply
3 replies to this topic

#1 weenoid

  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 28 March 2006 - 01:54 AM

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.

<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 :).

#2 toplay

  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 28 March 2006 - 03:53 AM

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]

#3 txmedic03

  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 28 March 2006 - 04:18 AM

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.


I can't stop you from doing something silly, but at least I can help you do it right.

#4 weenoid

  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 28 March 2006 - 09:33 AM

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.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users