BigMal Posted May 6, 2008 Share Posted May 6, 2008 Hi, The following piece of code is creating a list box of dates. The field u.fittest contains a color (eg. #CC0000) and I want the font color of each entry in the list to be that of the value in u.fittest. Can someone help me with this? Thanks in advance for any help. <? $sql="SELECT DISTINCT w.date, u.fittest from #__jform_workout w,#__jform_userworkout u where w.userid=u.id and u.user=".$_POST['user']." order by w.date "; $database->setQuery($sql); $objW=$database->loadObjectList(); if($objW) { foreach($objW as $obj) { if($_POST['date']==$obj->date) echo ("<option value='".$obj->date."' selected>".date('d-M-Y',strtotime($obj->date))." </option>"); else echo ("<option value='".$obj->date."' >".date('d-M-Y',strtotime($obj->date))." </option>"); } } ?> Quote Link to comment Share on other sites More sharing options...
AndyB Posted May 6, 2008 Share Posted May 6, 2008 it's html/CSS by giving a style to the select tag - which you have left out of your code! Example: echo "<select name='whatever' style='color:". $u.fittest. "'>";[code] [/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.