Squall2131 Posted February 26, 2006 Share Posted February 26, 2006 Can anyone tell me why this php generated table won't show up in internet explorer 6??The source code was from planetsourcecode.com, and I validated the site with W3C. This code works in Opera 9 and Firefox 1.5 Beta.It looks complicated, but all it does is produce a table with web safe colors for each cell background. In IE 6 the outline of the table shows up, but none of the cells or its colors; Just an empty table. When i view the source it has all the code in the page. *stumpted*[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body><? print("<table align='center' border='2' cellspacing='0' cellpadding='5' width='30%'>"); // variables r,g,b are string values for // Red, Green Blue $r = "00"; $g = "00"; $b = "00"; // variables numr, numg, numb are numeri // c values $numr = 0; $numg = 0; $numb = 0; // Variables i, j, k are counters for ($i = 0; $i <= 5; $i++) { for ($j = 0; $j <= 5; $j++) { print("<tr>"); for ($k = 0; $k <= 5; $k++) { //print out the html which will send a querystring with te selected hex value print("<td align='center' bgcolor='#" .$r .$g .$b ."'>"); //non-breaking spaces give clickablity. print("</td>"); // Incrementing Blue by 51 each time produces Web safe colors $numb += 51; //convert the numeric $b into hex $b = dechex($numb); } //close for $k //reset blue variables to 0 $b = "00"; $numb = 0; // Incrementing Green by 51 each time produces Web safe colors $numg += 51; //convert the numeric $g into hex $g = dechex($numg); print("</tr>"); } //close for $j //reset green variables to 0 $g = "00"; $numg = 0; // Incrementing Red by 51 each time prod // uces Web safe colors $numr += 51; //convert the numeric $r into hex $r = dechex($numr); } //close for $i print("</table>");?></body></html>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/3615-php-generated-color-table-will-not-show-in-ie-6/ Share on other sites More sharing options...
kenrbnsn Posted February 26, 2006 Share Posted February 26, 2006 These lines give a hint:[code]<?php //print out the html which will send a querystring with te selected hex value print("<td align='center' bgcolor='#" .$r .$g .$b ."'>"); //non-breaking spaces give clickablity. print("</td>");?>[/code]It looks like this used to produce a link for each background color and used the " " to make each cell clickable. When you (or whomever took away the link) changed to code, they also removed the "nbsp;". MSIE sees the empty table cell and collapses it down to nothing. All the other browsers collaspe the cells down to the minimumm size.I changed the code to be:[code]<?php print("<td align='center' bgcolor='#" .$r .$g .$b ."'> </td>\n");?>[/code]I put back the " " and put the "</td>" in the same print statement. I also added a few "\n" to make the resulting code eaiser for humans to read.The code now works correctly on both FF and MSIE.Ken Quote Link to comment https://forums.phpfreaks.com/topic/3615-php-generated-color-table-will-not-show-in-ie-6/#findComment-12530 Share on other sites More sharing options...
Squall2131 Posted February 26, 2006 Author Share Posted February 26, 2006 Thanks a lot, i didn't even notice the "nbsp;" when i was editing the file. Quote Link to comment https://forums.phpfreaks.com/topic/3615-php-generated-color-table-will-not-show-in-ie-6/#findComment-12531 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.