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>

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;  
 }

Wow. totally look over te tr!
..thanks...!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.