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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simon_porter00
Forum Newbie
Posts: 13
Joined: Thu Feb 25, 2010 1:25 pm

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

Post 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>");
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

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

Post 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.
simon_porter00
Forum Newbie
Posts: 13
Joined: Thu Feb 25, 2010 1:25 pm

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

Post by simon_porter00 »

Excellent work! Thanks for that - did just the job :)
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

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

Post by Eran »

The <font> tag and the align attribute are deprecated as well. Use CSS
Post Reply