Jump to content

[SOLVED] Cant get my head round this!


Ell20

Recommended Posts

Not sure if bgcolor is a valid td attribute, to be honest.  How about:

 

<?php
echo '<tr>';
for ($row=1;$row<=80;$row++) {
     if (isset($_POST['submit'])) { //You don't want colors unless they actually submitted!
               if (in_array($row, $matched)) {
                      $bgcolor = "purple";
               }
     }
     else {
               $bgcolor = "white";
     }
     printf('<td width="50" height="25" align="center" onMouseDown="changeto(event, \'%1$d\')" id="num%1$d" onMouseOver="this.style.cursor=\'pointer\'" style="background-color: %2$s;">%1$d</td>\n', $row, $bgcolor);
     if ($row % 8 == 0) {
               echo '</tr><tr>';
     }
}
echo '</tr>';
?>

 

Used CSS background colors.

My bad, let me fix that.  Should have realized.  I'll just add the other two in for you because I feel like a nice person tonight. xD  Here you go:

<?php
echo '<tr>';
for ($row=1;$row<=80;$row++) {
     if (isset($_POST['submit'])) { //You don't want colors unless they actually submitted!
               if (in_array($row, $matched)) {
                      $bgcolor = "purple";
               }
               elseif (in_array($row, $values)) {
                       $bgcolor = "red";
               }
               elseif (in_array($row, $nums)) {
                       $bgcolor = "blue";
               }
               else {
                       $bgcolor = "white";
               }
     }
     else {
               $bgcolor = "white";
     }
     printf('<td width="50" height="25" align="center" onMouseDown="changeto(event, \'%1$d\')" id="num%1$d" onMouseOver="this.style.cursor=\'pointer\'" style="background-color: %2$s;">%1$d</td>\n', $row, $bgcolor);
     if ($row % 8 == 0) {
               echo '</tr><tr>';
     }
}
echo '</tr>';
?>

 

;)

Having tested it quiet a few times, every so often I get this error:

 

Warning: Invalid argument supplied for foreach() in /home/streety/public_html/keno.php on line 43

 

Then the following printed lots of times:

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/streety/public_html/keno.php on line 91

 

Any ideas what might be causing this?

 

Cheers

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.