Solved

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

Posted on 2008-06-15
3
209 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
  • 2
3 Comments
 
LVL 4

Expert Comment

by:afzz
Comment Utility
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 500 total points
Comment Utility

//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
Comment Utility
Thanks very much.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now