Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Font Colour automatically

Status
Not open for further replies.

Sitehelp

Technical User
Feb 4, 2004
142
GB
Hello. I have a dynamic table that displays all calls that have been assigned a RED priority. There is a field in this table that show to whom the call has been assigned to. I want all records that say unassigned in this coloumn to be in RED. I thought this code would do it:

<?php
if ViewRedCalls.fields.item("StaffID").value = "unassigned" then
<tr bgcolor=red>
else
<tr>
end if
?>

But its not. The recordset is called ViewRedCalls, the column is the StaffID column. Any ideas! cheers!
 
What I see in your posting is a mish-mash between JavaScript and PHP. That ain't work. The snippet - if really in <? ?> should produce a parse error.
 
so should be written more like:


<script>
if ViewRedCalls.fields.item("StaffID").value = "unassigned" then
<tr bgcolor=red>
else
<tr>
end if
</script>

Yeah it did produce a parse error but now it loads the page up fine but without showing unassigned in red which is what I want! shall I take this to the javascript forum? Thanks!
 
That is a question you would get a great answer if asked in the JavaScript forum. A quick glance at your code makes me think: It won't work. Ask the JS guys.

It might be agood idea to sort out what PHP can do, what it can't:

PHP is server side. It can:
- write any HTML you want according to criteria based on database records, submitted values etc.

It can't:
- make any changes to a page that is in the client's browser.
- understand JavaScript values, objects etc. as they don't exist on the server.
 
mmm ok I know this wont work it just causes parse errors but would this be in the right diection in PHP:

if ViewRedCalls.StaffID = 'Unassigned'
<font color="#FF0000">

The unassigned field is automatically added in the database if no client has been assigned to that call. I would prefer php if possible at this point as that is the language I would like to learn first, one step at a time! Any ideas! thanks!
 
Right! ok well anyway, got rid of the parse error and the page loads up but the unassigned text does not go red????

if ($ViewAmberCalls.StaffID == "Unassigned")
{echo "<font color = \"#FF0000\">";}

This is not far off.... is it?
 
See what u mean, thanks! I have changed this now to:

if ($row_ViewAmberCalls['StaffID'] == "Unassigned")
{echo "<font color = \"#FF0000\">";}

This looks in the ViewAmberCalls table, row "StaffID' and looks for any record that is called unassigned and changed the unassigned text to red. However the page still loads up fine but the text is still not changing colour?
 
Is StaffID part of a loop variable (ie. one that you are changing... maybe you are incrementing it by 1 every interation)?

If so... you might want to change your code to:

Code:
$row_ViewAmberCalls[$StaffID]

I don't have access to php at the moment... but if the syntax is off I'm sure someone will followup. Regardless, this is just plain and simple php scripting where you are trying to compare the value of a variable with a known value to determine what to output to the page. Seemed like a really simple question - shame it took a while for your solution.

Jeff
 
Staff ID is a column in my dynamic table. The table gets each value from the recordset:

SELECT *
FROM callinfo
WHERE callinfo.CallStatus = 'Open' AND callinfo.Priority = 'Amber'

Then prints it all out in a table on the page. But what I want is for the PHP code to look in the table in the StaffID column and change all "unassigned" values to a red colour. Unassigned is a default value that is given automatically if nothing else was entered for this row on a previous page, this all works and appears on the screen fine. All the data appears in this table fine but the text isnt changing colour.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top