simple code

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
rami
Forum Contributor
Posts: 217
Joined: Thu Sep 15, 2005 8:55 am

simple code

Post by rami »

i have a link
<a href="page.php?uid={$_row[user_id]}..............

my problem or query is how can i use that pass value ie data passed through uid ...for comparing ...
ie in page.php
i want select one thing when uid =1...
and some thing other when uid=2...and so on

i used 2 logic
if ($_GET[uid])==1)
select.....

and
$va=$_GET[uid]
if (va==1)
select ...

else

but i fail in both
it says undefined variable uid....

how can i do it?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Hi, you should use the index key in the context according to it's type, i.e. you are referring to the key as a string, thus you need to reference it as you would a string:

Code: Select all

$_GET['uid']
HTH :)
Post Reply