Hi,

I posted yesterday with a problem for setting the back ground color of a page using a variable passed into the bgcolor tag using php. I was swiftly aided and found code that worked. I now tried that code in fire fox and it doesn't work. From researching i have found pointers that lead me to believe I need to use a css style sheet but I don't know how to get the variables into the css bit.

This is what I've got in the header which doesn't work.

<style type="text/css">
body {background-color: <?php echo $bgcol;?>}
}
</style>

Any help would be greatfully appreciated.

Many Thanks in Advance
R.

    See the source of the resulting page and there might be the answer...

    BTW if you're trying to echo a collor definition like #ff0000 you'll get nothing because the # is a comment line starter in PHP...

    Try echoing something like "red" or something to see whether it echoes something at all...

      Many Thanks -I solved the problem by looking at the source code and adding a # - I was passing a number so my new code that works for both firefox and ie is:

      <body bgcolor="#<?php echo $bgcol;?>">

      No need for a css style - - keep it simple!

      Thanks again
      R. 🙂

        Write a Reply...