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.

Link to comment
Share on other sites

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>';
?>

 

;)

Link to comment
Share on other sites

;D Thanks so much for your help!

 

I have one last issue and that is, is there anyway to use the same user values each time the submit button is pressed until the user leaves the page or presses the "reset" button??

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.