Solved

Table with links

Posted on 2002-06-20
8
173 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
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 …

733 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