PHP - Get a cell value from an html 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
admiralwonka
Forum Newbie
Posts: 1
Joined: Wed Jun 08, 2005 1:39 pm

PHP - Get a cell value from an html table

Post by admiralwonka »

Does anyone know if there is a way to get a value from a cell in an html table? I have seen multiple solutions for this in javascript, but I really need it in PHP.
I am dynamically generating a table on my page:

PHP code:
<TD ALIGN=LEFT ID='destCityRow[$counter]' CLASS='SmallText'>&nbsp; $destCity</TD>

HTML result:
<TD ALIGN=LEFT ID='destCityRow[0]' CLASS='SmallText'>Duluth</TD>

How can I retrieve the value from this cell (in this case the value is "Duluth") and put it in a PHP variable?

Any help would be appreciated!

Thanks
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

After execution of the script Javascript is your only choice - before execution you still can get the value of $destCity right ?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Code: Select all

if($counter === '0')
{
 $value_wanted_to_store_forever = $destCity;
}
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply