Click to See Complete Forum and Search --> : modifying HTML cells in PHP


blaster_master
03-05-2006, 05:27 PM
How is it possible to refer to a specific HTML table cell in PHP? Example:

Assume there is a simple HTML table with m rows and n columns. Outside this table there is a link which when pressed should change the color of the 2 - 4 cell (row 2, column 4) from #A to #B. If not possible in PHP, how can one do it in HTML? (I'd just echo the HTML solution in PHP)

Any help is appreciated.

Weedpacket
03-05-2006, 09:32 PM
You wouldn't want to do it in PHP, because PHP runs on the server and wouldn't know if anyone had clicked anything until it was asked to deliver a new page, and I suspect you don't want to reload the entire page just so that you can change the colour of a table cell. You can't do it in HTML because HTML isn't a programming language and so can't do anything.

You could do it in Javascript: give the relevant <td> element an id attribute, and then Javascript can locate the cell with getElementById('whateveryoucalledit');