Re: CSS and variables
| From: | richard@php.net | Date: | Fri, 20 Nov 2009 16:19:56 +0000 |
| Subject: | Re: CSS and variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-299970@lists.php.net to get a copy of this message | ||
Hi,
> $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.
You could do this:
<?php
$newcolor = 'red';
echo "<td style=\"{$newcolor}\">{$row[1]}</td>";
?>
--
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 14th November)
Lots of PHP and Javascript code - http://www.phpguru.org