DaveC426913
Programmer
The short question:
How can I allow a user to print a page so that it that prints the background-color of certain <divs/tables/1x1.gif/any object that can serve as a spacer>?
The long question:
I'm making a website that uses PHP to place little swatches of colour in a box. The colour hexcodes are pulled from a database.
The following code will create a tiny box with 1-to-n vertical swatches in it. I've included the table code and PHP code just for context.
All I really care about is either getting background-color: #nnnnnn to print out, or re-doing the divs so that the colour *will* print (i.e. I don't *have* to use divs if there's a better way - Any object that can be used as a spacer will do, as long as I can set its *colour* programmatically).
<table cellspacing="0" cellpadding="0" style="border: silver solid 1px;">
<tr>
<?
#loop through each colour, place a swatch of the colour
for ($j=1; $j<=$numColoursInPalette;$j++){
$sql = "SELECT Code FROM Colours WHERE `ID`='".$StylePaletteRow["Clr".$j]."'";
$resultG = mysql_query($sql);
$ColourRow=mysql_fetch_array($resultG)
?>
<td><div class="spcr" style="height: <?=$swatchsize?>px; width:<?=($swatchsize/$numColoursInPalette)?>px;
background-color: <?=$ColourRow['Code']?>;" /></td>
<? } ?>
</tr>
</table>
How can I allow a user to print a page so that it that prints the background-color of certain <divs/tables/1x1.gif/any object that can serve as a spacer>?
The long question:
I'm making a website that uses PHP to place little swatches of colour in a box. The colour hexcodes are pulled from a database.
The following code will create a tiny box with 1-to-n vertical swatches in it. I've included the table code and PHP code just for context.
All I really care about is either getting background-color: #nnnnnn to print out, or re-doing the divs so that the colour *will* print (i.e. I don't *have* to use divs if there's a better way - Any object that can be used as a spacer will do, as long as I can set its *colour* programmatically).
<table cellspacing="0" cellpadding="0" style="border: silver solid 1px;">
<tr>
<?
#loop through each colour, place a swatch of the colour
for ($j=1; $j<=$numColoursInPalette;$j++){
$sql = "SELECT Code FROM Colours WHERE `ID`='".$StylePaletteRow["Clr".$j]."'";
$resultG = mysql_query($sql);
$ColourRow=mysql_fetch_array($resultG)
?>
<td><div class="spcr" style="height: <?=$swatchsize?>px; width:<?=($swatchsize/$numColoursInPalette)?>px;
background-color: <?=$ColourRow['Code']?>;" /></td>
<? } ?>
</tr>
</table>