Using a variable in the URL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hwmetzger
Forum Commoner
Posts: 25
Joined: Fri Jun 12, 2009 1:11 pm

Using a variable in the URL

Post by hwmetzger »

Hello,

I'm trying to get a variable passed to another page via the URL. What I have right now is:
<a href="graph/graph.php?id=$store_number">


Then in the linked page I have:
$store = $_GET('$store_number');

I can't figgure out what I'm doing wrong. Any help would be awesome!
User avatar
jazz090
Forum Contributor
Posts: 176
Joined: Sun Apr 12, 2009 3:29 pm
Location: England

Re: Using a variable in the URL

Post by jazz090 »

needs to be $_GEt['var'] instead of parenthesis
hwmetzger
Forum Commoner
Posts: 25
Joined: Fri Jun 12, 2009 1:11 pm

Re: Using a variable in the URL

Post by hwmetzger »

I fixed it and now it seems like it's just passing a string.

The value that I get from that is "$store"

I'm getting the variable name instead of the value in the variable.

Main Page:
<a href="graph/graph.php?id=$store"> Graph </a>

Graph Page:
<?$value = $_GET['id'];?>

and echo of $value gives "$store"
hwmetzger
Forum Commoner
Posts: 25
Joined: Fri Jun 12, 2009 1:11 pm

Re: Using a variable in the URL

Post by hwmetzger »

Never mind, I figgured it out.


<a href="graph/graph.php?id=<?=$store?>"> Graph </a>
Post Reply