Solved

Table with links

Posted on 2002-06-20
8
170 Views
Last Modified: 2012-05-04
I am using PHP/MySql

I am building an html table at runtime and populating it using values from my db. I want these to be links.

How can I pass the link label to another page for processing.
0
Comment
Question by:bravismore
8 Comments
 
LVL 5

Expert Comment

by:dkjariwala
ID: 7095555
I am not sure what you want to achieve. Can you explain it by example ? Say whats ur table defination , how u want it to look like etc.

JD
0
 

Author Comment

by:bravismore
ID: 7095614
let's say we have the following table:

  COMMERCE    | INDUSTRY

  AGRICULTURE | LAW

that's a table with 2 rows and 2 columns populated with values from database(i.e COMMERCE, INDUSTRY etc). I have made these table values links to a certain document which should process using the value clicked by user.

Lets say a user clicks on COMMERCE link, I want the value COMMERCE to be passed to the document. When a user clicks on INDUSTRY, I want the value INDUSTRY passed to the document being launched.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7095866
Ok.

So when you are generating the table, you can use ...

echo "<a href=\"handler.php?link=$db_field_you_want_goes_here\">$db_field_you_want_goes_here</a>";



The handler.php file has

if (isset($_GET["link"]))
 {
// The value of $_GET["link"] reflects the chosen value.
 }

If you are using an earlier version of PHP (one without the super globals), then you may find that $link is already available and can be used as

if (isset($link))
 {
// The value of $link reflects the chosen value.
 }

Regards,

Richard.

P.S. I thought I'd already replied to this! Obviously not!
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:bravismore
ID: 7096087
Is handler.php a predefined script or user-defined script?

Where should I place the target page, Should I replace handler.php with my own page.
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 50 total points
ID: 7096100
If you have a page that you want to use as the handler then use that. If you page is called index.php, then ...

echo "<a href=\"index.php?link=$db_field_you_want_goes_here\">$db_field_you_want_goes_here</a>";

In index.php, you need to test on $_GET["link"] to see if it is set (isset()) and what its value is.

You can then handle the value sent to you.
0
 
LVL 11

Expert Comment

by:shmert
ID: 9643532
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept: rquadling
Please leave any comments here within the next seven days.
               
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
               
Sam Barnum
EE Cleanup Volunteer              
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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 dynamically set the form action using jQuery.

810 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