Stefan: Benötige Hilfe bei Algorithmus

Beitrag lesen

Hallo dedlfix,

So, musste doch nachschauen, aber jetzt habe ich es (hoffentlich):

  
// Build tables. 3 rounds per table.  
$input .= "<table><tr>\n";  
$max_rounds = $_POST['rounds'];  
$max_players = $_POST['players'];  
  
for($round_header = 1, $table= 1; $table <= $max_rounds; $table+=3) {  
  $round_placings = $round_header;  
  // Build table headers.  
  for($column = 1;  
      $column <= 3 and $round_header <= $max_rounds;  
      $column++, $round_header++) {  
    $input .= "<th></th><th>Runde $round_header:</th>\n";  
  }  
  $input .= "</tr>\n";  
  // Build as many rows as players.  
  for ($row = 1; $row <= $max_players ; $row++) {  
    $temp = $round_placings;  
    $input .= "<tr>\n";  
    for ($column = 1;  
         $column <= 3 and $temp <= $max_rounds;  
         $column++, $temp++) {  
      $input .= "<td>$row.</td><td><input type=\"text\" name=\"round:$temp-place:$row\"/></td>\n";  
    }  
    $input .= "</tr>\n";  
  }  
  
  if ($round <= $max_rounds) {  
    $input .= "</table>\n<table><tr>\n";  
  }  
}  
$input .= "<td></td></tr></table>\n";  
echo $input;  
}  

Vielen Dank für Deine Hilfe,

Stefan