Page 1 of 1

Selecting items from a table

Posted: Wed Apr 06, 2005 11:36 am
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.

Posted: Wed Apr 06, 2005 11:40 am
by feyd
define "selected".

Sounds like Javascript stuff, not PHP.

Posted: Wed Apr 06, 2005 11:44 am
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

Posted: Wed Apr 06, 2005 12:21 pm
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;>

Posted: Thu Apr 07, 2005 2:47 am
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.