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>"); } } ?> Link to comment https://forums.phpfreaks.com/topic/104335-solved-a-bit-of-noob-question-re-font-colors-in-a-drop-down-list/ 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] Link to comment https://forums.phpfreaks.com/topic/104335-solved-a-bit-of-noob-question-re-font-colors-in-a-drop-down-list/#findComment-534229 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.