Selecting items from a table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
carbine
Forum Newbie
Posts: 6
Joined: Mon Mar 14, 2005 6:37 am

Selecting items from a table

Post by carbine »

I am trying to develop a HTML table with embedded PHP so that when a row is selected, that row is highlighted and its index can be found? Not entirely sure how to implement this ANY iDEAS ANYONE?

PS I've developed the table trying to implement row selection.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

define "selected".

Sounds like Javascript stuff, not PHP.
carbine
Forum Newbie
Posts: 6
Joined: Mon Mar 14, 2005 6:37 am

Post by carbine »

by seleceted I meand that the user would click on a row from the table and it would become highlighted, the index of that highlighted row would be known and stored somehow.

Thanks for showing your interest, the only examples I can find on the web at the moment seem to be javascript ones
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

Need javascript you do. Be totally done in php it can not. Client side stuff this is.

try something like this you should:

Code: Select all

<tr onClick=&quote;this.style.backgroundColor='343433'&quote;>
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

A possible useful link for javascript:

http://www.alistapart.com/articles/tableruler/

Ok it uses a hover event but may be of use. Getting it to be a click event wouldn't be too hard to do. I would keep it as a hover event with the onclick storing the value, not doing anything with the display.
Post Reply