Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to pass arguments by clicking on hyperlink and then catch those in target php file?

Posted on 2008-06-15
3
Medium Priority
?
254 Views
Last Modified: 2010-04-21
Hi

I have one php file which contain some hyperlinks. I want php-coding that when a hyperlink is clicked then the target file should know the location (directory name & path) and hyperlink name/heading from where the hyperlink was clicked.

Target file should store this value in a variable.

For example : goto  [ http://thegurbani.com/index.php/Static-Category/audio.html  ]

You will seesome hyperlinks like 1. audio , 2. tmp 3. media

Now the target file which is "index.php" in each directory should know that it is activated by clicking on "audio" or in other case "tmp" or "media" and it should store this info in a vaiable.

Plz note number of hyperlinks and their names are dynamic. So your code should change accordingly.
0
Comment
Question by:theredcode
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:afzz
ID: 21787975
Try the below code to pass the variable.
//In your php file
//$target can be audio tmp media anything
echo "<a href="index.php?src=$target">$target</a>";
 
//In your index.php file
$src=$_REQUEST['src'];
//now your passed variable is available in $src

Open in new window

0
 
LVL 4

Accepted Solution

by:
afzz earned 2000 total points
ID: 21787976

//In your php file
//$target can be audio tmp media anything
echo "<a href=\"index.php?src=$target\">$target</a>";
 
//In your index.php file
$src=$_REQUEST['src'];
//now your passed variable is available in $src

Open in new window

0
 

Author Closing Comment

by:theredcode
ID: 31467313
Thanks very much.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question