0

Hello Everybody,
I am trying to create a bingocard with 6 rows and on each row 10 numbers. Row 1 from 10 to 19 (randomly), row 2 from 20 to 29 etc.
The code I have till now, displays only one long row from 10 till 69 randomly as supposed.
Can't figure out anymore (trail and error) how to break this row in multiple rows. So please guide me in the right solution.
Thanks already

The code:

<html>
<body>

<?php
mt_srand((double)microtime()*1000000);
//Een bijzondere aanpak voor het vullen
function Vullen()
{
    $getallen = array(0,1,2,3,4,5,6,7,8,9);
    shuffle($getallen);
    return $getallen;

}

$getallen = Vullen(); 

//De functie display is om de getallen aan de rijnummers te koppelen: dus 1 + 0 t/m 9 voor rij 1 en 2 + 0 t/m 9 voor rij twee etc
 function display($getallen){

 $table = '<table  border="1px" cellpadding="1px">';    

 $bingokaart = array(); 

 for ($row = 1; $row < 7; ++$row)
    //iets met rijnummer doen en deze printen?
        foreach ($getallen as $number){

        $table .= '<td>'  .$row .  $number .'</td>';

    }

     echo $table;
 }

display($getallen);

?>

</body>
</html>
2
Contributors
2
Replies
31
Views
8 Months
Discussion Span
Last Post by reminem
1

Replace your display Function with this code. You missed to put <tr> tag in your table

function display($getallen){
 $table = '<table  border="1px" cellpadding="1px">';
 $bingokaart = array();

 for ($row = 1; $row < 7; ++$row){
     $table .= '<tr>';
     //iets met rijnummer doen en deze printen?
        foreach ($getallen as $number){
        $table .= '<td>'  .$row .  $number .'</td>';
    }
    $table .= '</tr>';
 }

  $table .='</table>'; 
echo $table;  
 }

Edited by Bachu

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.