Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-22-2005, 03:53 AM   #1
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 668
Blog Entries: 7

Rep: Reputation: 31
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 ifset() or something like it...

Is it possible??
Old 12-22-2005, 06:54 AM   #2
Registered: Mar 2003
Location: Berkshire, England.
Distribution: SuSE 10.0
Posts: 299

Rep: Reputation: 32
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.
Old 12-23-2005, 01:27 PM   #3
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 41
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass a row to another PHP script bahadur Programming 5 12-24-2011 01:07 AM
Are PHP session variables held in memory when you leave a PHP site? Locura Programming 11 11-16-2008 08:37 PM
script (or other) to pass variables to C++ program ngwenyama Programming 9 01-20-2005 09:54 PM
Pass multiple URL variables PHP agallant Programming 3 10-21-2004 07:29 PM
PHP Pass Parameter Gerardoj Programming 2 05-25-2004 08:12 AM

All times are GMT -5. The time now is 10:18 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration