Solved

Format text in <option>

Posted on 2007-03-27
3
183 Views
Last Modified: 2007-03-27
In the code below, only "Current/History" text is correctly formatted as class "selectmenutext".
What is within the php code (<option>) text is not. How can I format the text in <option>?
As you can see, I tried both using class in <td> and <span>.
Thanks

<td  valign="center" width="120" bgcolor="#339999"  class=selectmenutext>
<span class=selectmenutext>
Current/History: <select onchange="window.location='index.php?coh='+this.value">
<?php
global $currORhist;
$list = array("Current","Historical");
for ($i = 0; $i <= 1; $i++) {
echo "<option value=\"$list[$i]\"";
if ($currORhist == $list[$i]) print " SELECTED";
echo ">" . $list[$i];
echo "</option>";
}
?>
</select>
</span>
0
Comment
Question by:spoowiz
  • 2
3 Comments
 
LVL 29

Accepted Solution

by:
rdivilbiss earned 500 total points
ID: 18805861
echo "<option class=\"theClass\" value=\"$list[$i]\""
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18805863
<style type="text/css">
.theClass {
     //whatever you want
}
</style?
0
 

Author Comment

by:spoowiz
ID: 18805873
thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question