Page 1 of 1

problem with php and bgcolor in ie & chrome, fine in FF

Posted: Tue Oct 05, 2010 6:38 am
by simon_porter00
Hello All,
Probably something really simple that I'm missing that's causing bgcolour load problems in ie and chrome. If $mon69 is selected it's meant to change colour from #ffffff to #FF7E06. This bit is fine. If it's not selected it's meant to saty at #fffffff. In ie and chrome it's displayed as a red background colour. Any ideas what might be going on? TIA.

Code: Select all

$available=$row['TeacherTimes'];

 if ($available=="69mon"){
$mon69="#ffffff";
   }

$available=$row['TeacherTimes'];

 if ($available=="69tue"){
$tue69="#ffffff";
   }

   $available=$row['TeacherTimes'];

    if ($available=="69wed"){
   $wed69="#ffffff";
   }

   $available=$row['TeacherTimes'];

    if ($available=="69thu"){
   $thu69="#ffffff";
   }

$available=$row['TeacherTimes'];

 if ($available=="69fri"){
$fri69="#ffffff";
   }

   $available=$row['TeacherTimes'];

    if ($available=="69sat"){
   $sat69="#ffffff";
   }

$available=$row['TeacherTimes'];

 if ($available=="69sun"){
$sun69="#ffffff";
   }

Code: Select all

print("<td align=center bgcolor=$mon69 height=10><font color=#FF7E06>YES</font></td>");
print("<td align=center bgcolor=$tue69 height=10><font color=#FF7E06>YES</font></td>");
print("<td align=center bgcolor=$wed69 height=10><font color=#FF7E06>YES</font></td>");
print("<td align=center bgcolor=$thu69 height=10><font color=#FF7E06>YES</font></td>");
print("<td align=center bgcolor=$fri69 height=10><font color=#FF7E06>YES</font></td>");
print("<td align=center bgcolor=$sat69 height=10><font color=#FF7E06>YES</font></td>");
print("<td align=center bgcolor=$sun69 height=10><font color=#FF7E06>YES</font></td>");

Re: problem with php and bgcolor in ie & chrome, fine in FF

Posted: Tue Oct 05, 2010 7:11 am
by cpetercarter
The 'bgcolor' attribute is deprecated, and presumably does not work in the versions of IE and Chrome which you are using.

Use

Code: Select all

echo "<td align=center style=\"background-color: $mon69;\"  height=10><font color=#FF7E06>YES</font></td>" 
instead.

Re: problem with php and bgcolor in ie & chrome, fine in FF

Posted: Tue Oct 05, 2010 7:22 am
by simon_porter00
Excellent work! Thanks for that - did just the job :)

Re: problem with php and bgcolor in ie & chrome, fine in FF

Posted: Tue Oct 05, 2010 7:51 am
by Eran
The <font> tag and the align attribute are deprecated as well. Use CSS