RES: CSS and variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try:

echo '<td style="' . $newcolor .'">' . $row[1] . '</td>';

-----Mensagem original-----
De: Phil Matt [mailto:admin@xxxxxxxxxxxx] 
Enviada em: sexta-feira, 20 de novembro de 2009 14:12
Para: php-general@xxxxxxxxxxxxx
Assunto:  CSS and variables

De-lurking here.

I'm trying, with no success, to use some CSS styling on my PHP output.

Here's the code I want to style:

echo '<tr><td class="spacer">'.$row[0].'</td><td>'.$row[1].'</td>

I want to use a CSS style for the second <td> cell, picking up the style 
from the value of a variable. I tried this:

$newcolor = "color: red";

<td style= "<? echo($newcolor): ?>">'.$row[1].'</td>

But it doesn't work. No problem with th "spacer" class, works fine. I 
just can't get the syntax for pulling a CSS style from a PHP var.

TIA for your help!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux