For standards compliance, use CSS:

Define the style either at the top of the page or in a linked style sheet.

Changing the background colors by defining a style at top of page would look
like:

<style>
.noselect {background-color: white;}
.complete {background-color: green;}
.pending {background-color: yellow;}
.stalled {background-color: red;}
</style>

Then when writing your page, use a function to apply the format, such as ...

function choose_status() {
        if(isset($_POST['submitted'])) {
                if($_POST['choose status'] == 0) {
                        echo 'class="pending"';
                } elseif($_POST['choose status'] == 1) {
                        echo 'class="stalled"';
                } elseif($_POST['choose status'] == 2) {
                        echo 'class="complete"';
                } else { echo 'class="noselect"';
                }
        } else { 
                echo 'class="noselect"':\
        }

For instance, the dropdown could be written:

<p>Status: <select size="1" name="choose status" <?php choose_status() ?> >
                <option value="0">Pending</option>
                <option value="1">Stalled</option>
                <option value="2">Complete</option>
        </select>


May you always have enough,

Shay


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Brian E Boothe
Sent: Wednesday, September 19, 2007 7:53 AM
To: [email protected]
Subject: [php-list] Field Changed color on status

hi all :
   i want to be able to have my Listed Feild Change a diffrent Color 
Depending on if the job is Completed "green"  Pending:"yellow"  
Stalled:"red"
  So when the user Selects Pending in the dopdown and he lists the Job 
it will be Colored "yellow" with the words Pending:

   thanks



[Non-text portions of this message have been removed]



Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links





Reply via email to