Computer Science Canada

making a link change the value of a variable...

Author:  Homer_simpson [ Fri Aug 01, 2003 3:03 pm ]
Post subject:  making a link change the value of a variable...

http://user.deluxnetwork.com/~backstabbe/phptest/searchresult.php
as u can see i've got my sign up system working... now u see that when u move yer mouse over "Rune Name" or "Rank" the color changes that means that there's gonna be a link there... now what i want to know is how to relate a link into php meaning that when i click on one of those a specific variable changes value... How do u do that...?!!?!

"I know how to do that using forms..."

Author:  Amailer [ Fri Aug 01, 2003 4:17 pm ]
Post subject: 

you mean set a value to a variable froma URL?

like $PHP_SELF?runename=$value for run name&rank=$value for rank

so you can put that in the OnCLICK or ahref= or whe/

Author:  PaddyLong [ Fri Aug 01, 2003 4:36 pm ]
Post subject: 

just use "get" variables which are the ones that go into the url.. just put a ? after the file (or url or whatever) and then the variable=something and if there are more than one variables use & in between them

http://www.someurl.com/somepage.php?variable1=something&variable2=somethingelse

then in that somepage.php file you can access those variables using $_GET['variable1'] and $_GET['variable2']
or (for older versions of php...)
$HTTP_GET_VARS['variable1'] and $HTTP_GET_VARS['variable2']

Author:  Homer_simpson [ Fri Aug 01, 2003 6:52 pm ]
Post subject: 

aha....!!! that's what i wanted TY...

so let's say i got URL http://blah.com/blah.php?rank=leader&name=homer

then inside my blah.php i use this code like this ?? :
code:

$A_name=_GET[name];
$A_rank=_GET[RANK];


is that right?

Author:  Amailer [ Fri Aug 01, 2003 7:00 pm ]
Post subject: 

yes, thats right but the _GET[name]; has to be $_GET['name'];

You need the '' or you could use ""
and there has to be a $ before the _GET Very Happy

same with the rank Very Happy

Author:  Homer_simpson [ Fri Aug 01, 2003 7:10 pm ]
Post subject: 

TY...
One More thing... Razz using OnCLICK what was the command to redirect?
OnCLICK=geturl"blah.com" ?

Author:  Amailer [ Fri Aug 01, 2003 7:17 pm ]
Post subject: 

No, since you have a table that uses 'OnMouseOver' or w/e,
You could use OnClick (same place you use the OnMouseover or w/e)...so whne the viewer clicks the table, it will go to thURL given in the onClick Confused

Like...
code:

onMouseOver="this.style.backgroundColor='#feeebe'; this.style.cursor='hand';" onMouseOut="this.style.backgroundColor='#f8e8b8';" onclick="window.location.href='http://yourdomain.com/'"



Confused

BTW, thats hosted on your computer right?
Use dyndns.org, its much better Confused!

Author:  Homer_simpson [ Fri Aug 01, 2003 9:03 pm ]
Post subject: 

no that is not hosted on my compuer...

Author:  Amailer [ Fri Aug 01, 2003 9:04 pm ]
Post subject: 

Oh ok Smile thought it was nvm Confused


: