Solved

Table with links

Posted on 2002-06-20
8
174 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses four methods for overlaying images in a container on a web page
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 …

724 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