chaosxkitten Posted March 13, 2011 Share Posted March 13, 2011 I have the hardest time spotting my own errors.... I'm writing some CSS that depends on PHP. This is the php created css... <?php if (isset($_POST['submitted'])){ //variables from form $bars2 = $_POST['stages']; $first2 = $_POST['first']; $last2 = $_POST['last']; //Separate the rgb values $fv = explode(",","$first"); $lv = explode(",","$last"); //Do some math to figure out the step value $n = ($bars - 1); $j1 = (($lv["0"] - $fv["0"])/$n); $j2 = (($lv["1"] - $fv["1"])/$n); $j3 = (($lv["2"] - $fv["2"])/$n); //Variables and math. $step = ($bars2 - 2); $l = "0"; $w = (100 / $bars2); $r = $fv["0"]; $g = $fv["1"]; $b = $fv["2"]; // gerneral div CSS echo "div { position: absolute; top: 20px; height: 600px; }"; //First bar echo "#start { position: absolute; left: $l%; width: $w%; background-color: rgb($first2); }"; //Middle Bars while ($step != 0){ $r += $j1; $g += $j2; $b += $j3; $l += $w; $r2 = round($r); $g2 = round($g); $b2 = round($b); echo "#$step { position: absolute; left: $l%; width: $w%; background-color: rgb($r2,$g2,$b2); }"; $step -= 1; } $l += $w; //Last bar echo "#end { position: absolute; left: $l%; width: $w%; background-color: rgb($last2); }"; } ?> and this is the php that defines the div elements.. if (isset($_POST['submitted'])) { //variables from form $bars = $_POST['stages']; //Display necessary div tags $div = ($bars - 2); echo '<div id="start"></div>'; while ($div != 0){ echo "<div id='$div'></div>"; $div -= 1; } echo '<div id="end"></div>'; and here is the link of where I'm testing it... http://easlnx01.eas.muohio.edu/~meadecm/tvtest.php Something is not letting the middle bar divs print, and I can't find the error. My loop seems to work because it adds the correct amount of space in the center. Please don't hack me X.X Link to comment https://forums.phpfreaks.com/topic/230551-css-by-php/ Share on other sites More sharing options...
gizmola Posted March 13, 2011 Share Posted March 13, 2011 A css ID name can not start with a number. It has to be a letter from a-z first. Link to comment https://forums.phpfreaks.com/topic/230551-css-by-php/#findComment-1187158 Share on other sites More sharing options...
chaosxkitten Posted March 13, 2011 Author Share Posted March 13, 2011 well @#$%^&*(. Link to comment https://forums.phpfreaks.com/topic/230551-css-by-php/#findComment-1187161 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.