pioneerx01 Posted December 17, 2010 Share Posted December 17, 2010 I am running a query from database tables and results are displayed in array for a drop down menu. The code looks like this { echo "<option value='{$row['field1']} in {$row['field2']}'>{$row['field1']} in {$row['field2']}</option>"; } I want the last "in {$row['field2']}" to be in italics. I can not seem to get it working. Thanks Link to comment https://forums.phpfreaks.com/topic/222014-how-do-i-itlaicize-this/ Share on other sites More sharing options...
litebearer Posted December 17, 2010 Share Posted December 17, 2010 Perhaps... <option value="<?PHP echo $row['field1'] . " in " . $row['field2']; ?>"><?PHP echo $row['field1'] . "<i> in " . $row['field2']; ?></i></option> Link to comment https://forums.phpfreaks.com/topic/222014-how-do-i-itlaicize-this/#findComment-1148793 Share on other sites More sharing options...
Rifts Posted December 17, 2010 Share Posted December 17, 2010 why do that when you can do this!! <?php function actuallyconvert($var) { $var = "<i>".$var."</i>"; return $var; } function sendtoconverter($var) { $var = actuallyconvert($var); return $var; } function convert($var) { $var = sendtoconverter($var); return $var; } ?> <option value="<?PHP echo $row['field1'] . " in " . $row['field2']; ?>"><?PHP echo $row['field1'] . convert($row['field2']); ?></i></option> Link to comment https://forums.phpfreaks.com/topic/222014-how-do-i-itlaicize-this/#findComment-1148795 Share on other sites More sharing options...
Pikachu2000 Posted December 17, 2010 Share Posted December 17, 2010 I don't believe you can italicize a select box option with html. Possibly with css, but I'm not certain. Link to comment https://forums.phpfreaks.com/topic/222014-how-do-i-itlaicize-this/#findComment-1148803 Share on other sites More sharing options...
litebearer Posted December 17, 2010 Share Posted December 17, 2010 As usual, Pika is my resource --- http://www.electrictoolbox.com/style-select-optgroup-options-css/ Link to comment https://forums.phpfreaks.com/topic/222014-how-do-i-itlaicize-this/#findComment-1148805 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.