Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Table with links

Posted on 2002-06-20
8
Medium Priority
?
176 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
[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
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 count occurrences of each item in an array.
Suggested Courses

604 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