Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Form Menu help

  1. #1
    New Coder
    Join Date
    Jan 2005
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form Menu help

    I have a form menu as shown below:

    <select name="final" size="1" id="final">
    <option>WIN</option>
    <option>TIE</option>
    <option>LOSS</option>
    </select>

    the choice selected is displayed on another page

    How do you make the displayed choice font color green for win, red for loss, and blue for tie?? thanks

  • #2
    New Coder
    Join Date
    Dec 2004
    Location
    Ontario, Canada
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Use CSS

    You can use CSS to change the color of the font for the selections.

    Just put this in the head of your document
    PHP Code:
    <style type="text/css">
    <!-- 
    option.win colorgreen; } 
    option.loss colorred; }
    option.tie colorblue; }
    -->
    </
    style
    and replace the code for the selction menu in the body with this
    PHP Code:
    <select name="final" size="1" id="final">
    <
    option class="win">WIN</option>
    <
    option class="tie">TIE</option>
    <
    option class="loss">LOSS</option>
    </
    select

    Hope this heps.

    Nite

  • #3
    New Coder
    Join Date
    Jan 2005
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    that changes the color of the form, not what is displayed that is choosen

    What is selected is stored into a mysql database, then retrieved

    need to know how to change the color of that what is retrieved, something like an if else statement

    confusing, but i know it can be down

    this is what it looks like the page with what was choosen looks like:

    PHP Code:
    <?
    include("config.php");
    mysql_connect(localhost,$username,$password);
    @
    mysql_select_db($database) or die( "Unable to select database");
    $query="SELECT * FROM matches ORDER BY id DESC LIMIT 0, 999";
    $result=mysql_query($query);

    $num=mysql_numrows($result); 

    mysql_close();
    ?>
    <table width="390" border="0" cellspacing="2" cellpadding="2">
      <tr> 
        <td width="390"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Date</strong></font></td>
        <td width="390"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Opponent</strong></font></td>
        <td width="390"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>League</strong></font></td>
        <td width="390"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Map</strong></font></td>
        <td width="390"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Score</strong></font></td>
        <td width="390"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Result</strong></font></td>
      </tr>
      <?
    $i
    =0;
    while (
    $i $num) {
    $matchdate=mysql_result($result,$i,"matchdate");
    $opponent=mysql_result($result,$i,"opponent");
    $league=mysql_result($result,$i,"league");
    $map=mysql_result($result,$i,"map");
    $score=mysql_result($result,$i,"score");
    $final=mysql_result($result,$i,"final");

    ?>
      <tr> 
        <td width="390"><font size="2" face="Times New Roman, Times, serif"><? echo "$matchdate"?></font></td>
        <td width="390"><font size="2" face="Times New Roman, Times, serif"><? echo "$opponent"?></font></td>
        <td width="390"><font size="2" face="Times New Roman, Times, serif"><? echo "$league"?></font></td>
        <td width="390"><font size="2" face="Times New Roman, Times, serif"><? echo "$map"?></font></td>
        <td width="390"><font size="2" face="Times New Roman, Times, serif"><? echo "$score"?></font></td>
        <td width="390"><font size="2" face="Times New Roman, Times, serif"><b><? echo "$final"?></b></font></td>
      </tr>
      <?
    ++$i;

    echo 
    "</table>";


    ?>
    Last edited by huntherr; 01-24-2005 at 11:05 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •