Note that there are some explanatory texts on larger screens.

plurals
  1. POCasting a variable to write CSS
    text
    copied!<p>So, I'm making a table, and I want to use a 4-color scheme selected at random from a group of 10 schemes.</p> <p>Here's my CSS/PHP:</p> <pre><code>&lt;?php header('Content-type: text/css'); // 0 grey $color00 = '#959595'; //light grey $color10 = '#616161'; //medium grey $color20 = '#414141'; //dark grey $color30 = '#dfdfdf'; //white grey // 1 pink $color01 = '#e45494'; //light pink $color11 = '#d70060'; //medium pink $color21 = '#900040'; //dark pink $color31 = '#f7ccdf'; //white pink // 2 red $color02 = '#ee576f'; //light red $color12 = '#e50428'; //medium red $color22 = '#9a031b'; //dark red $color32 = '#facdd4'; //white red // 3 orange //(etc, up to 09-39) $seed = rand(0,9); $lightcolor = "color0".$seed; $medcolor = "color1".$seed; $darkcolor = "color2".$seed; $whitecolor = "color3".$seed; ?&gt; #wttbl{ border:0; border-collapse:collapse; cellpadding:3; width:500px; font-family:Verdana; font-size:9px; } #wttbl td, #wttbl th{ padding: 4px; } #wttbl #header{ background:&lt;?="$lightcolor"?&gt;; } #wttbl td{ text-align:right; color:#414141; } #wttbl .odd{ background:&lt;?="$color33"?&gt;; } #wttbl .even{ } #wttbl tr:hover{ background:&lt;?="$color03"?&gt;; } #wttbl td:hover{ background:&lt;?="$color23"?&gt;; color:white; } </code></pre> <p>The problem is that, hardcoding things like</p> <pre><code>#wttbl .odd{ background:&lt;?="$color33"?&gt;; } </code></pre> <p>seem to work, and echo the proper css color into my code, while things like</p> <pre><code>#wttbl #header{ background:&lt;?="$lightcolor"?&gt;; } </code></pre> <p>echo "color03" into the tag. </p> <p>What am I doing wrong, and how can I fix it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload