eva21 Posted May 19, 2009 Share Posted May 19, 2009 php function: function Hilight($val1, $val2){ $return = ""; if($val1 == $val2){ $return = " style='background-color:blue'"; } return($return); } php code: $teach = "cat"; echo("<option value='cat'><font " . Hilight("cat",$teach) . "> cat </font></option>"); This code should make cat hilighted with blue so why does it not work? Quote Link to comment https://forums.phpfreaks.com/topic/158746-php-list-boxes-hilighting/ Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 Try... function Hilight($val1, $val2){ $return = ""; if($val1 == $val2){ $return = " style='color:blue;'"; } return($return); } php code: $teach = "cat"; echo("<option value='cat'><span " . Hilight("cat",$teach) . "> cat </span></option>"); Quote Link to comment https://forums.phpfreaks.com/topic/158746-php-list-boxes-hilighting/#findComment-837234 Share on other sites More sharing options...
eva21 Posted May 19, 2009 Author Share Posted May 19, 2009 Unfortunately that didnt make a difference. Thanks for trying. Quote Link to comment https://forums.phpfreaks.com/topic/158746-php-list-boxes-hilighting/#findComment-837236 Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 Unfortunately that didnt make a difference. Thanks for trying. Can you post the output here? Quote Link to comment https://forums.phpfreaks.com/topic/158746-php-list-boxes-hilighting/#findComment-837238 Share on other sites More sharing options...
eva21 Posted May 19, 2009 Author Share Posted May 19, 2009 It was simply cat...nothing hilighted or background color. Quote Link to comment https://forums.phpfreaks.com/topic/158746-php-list-boxes-hilighting/#findComment-837240 Share on other sites More sharing options...
Daniel0 Posted May 19, 2009 Share Posted May 19, 2009 It's spelled highlight. Just saying Quote Link to comment https://forums.phpfreaks.com/topic/158746-php-list-boxes-hilighting/#findComment-837243 Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 It was simply cat...nothing hilighted or background color. Can you post the source code? Quote Link to comment https://forums.phpfreaks.com/topic/158746-php-list-boxes-hilighting/#findComment-837245 Share on other sites More sharing options...
eva21 Posted May 19, 2009 Author Share Posted May 19, 2009 function Hilight($val1, $val2){ $return = ""; if($val1 == $val2){ $return = " style='color:blue;'"; } return($return); } echo("<option value='cat'><font" . Hilight("cat",$teach) . "> cat </font></option>"); Quote Link to comment https://forums.phpfreaks.com/topic/158746-php-list-boxes-hilighting/#findComment-837248 Share on other sites More sharing options...
Daniel0 Posted May 19, 2009 Share Posted May 19, 2009 I think Masna meant the HTML source code... Quote Link to comment https://forums.phpfreaks.com/topic/158746-php-list-boxes-hilighting/#findComment-837250 Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 function Hilight($val1, $val2){ $return = ""; if($val1 == $val2){ $return = " style='color:blue;'"; } return($return); } echo("<option value='cat'><font" . Hilight("cat",$teach) . "> cat </font></option>"); ... The HTML source that's outputted. (I guess I had this coming to me.) Quote Link to comment https://forums.phpfreaks.com/topic/158746-php-list-boxes-hilighting/#findComment-837251 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.