Solved

Table with links

Posted on 2002-06-20
8
167 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:RQuadling
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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:
RQuadling 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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 …

747 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

12 Experts available now in Live!

Get 1:1 Help Now