LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   pass variables through hyperlink in php (https://www.linuxquestions.org/questions/programming-9/pass-variables-through-hyperlink-in-php-395569/)

ALInux 12-22-2005 03:53 AM

pass variables through hyperlink in php
 
Hi guys...Ive got a site with 10 hyperlinks ....when any of these hyperlinks is pressed I want to load a new page which displays info depending on the link pressed....

I mean in receiving page how can I determine which link was pressed...like ifset() or something like it...

Is it possible??

Spudley 12-22-2005 06:54 AM

If you hyperlink looks something like "page.php?id=3", then in the PHP program, you'll get a variable called $_REQUEST['id'], which will have a value of "3".

Any value passed in the query string that way will be available in the $_REQUEST array.

Hope that helps. :)

taylor_venable 12-23-2005 01:27 PM

You can also find it by using $_GET["id"], which will only return variables in the URL (i.e. using the GET method). Using $_REQUEST["id"] will check GET variables, POST variables, and cookie variables; but I don't know in which order. So you might be safer to use $_GET instead of $_REQUEST.


All times are GMT -5. The time now is 03:23 AM.