Witam ostatnio miałem problem z checkboxami. Teraz mam ze zwykłym php.
Wyciągam dane z bazy do typowania
  1. <?php
  2. echo "<form action="modules.php?name=typki" method="post"><font class="option">";
  3. echo "<input type="hidden" name="buid" value="$buid" >";
  4. echo "<input type="hidden" name="nuid" value="$nuid" >";
  5. echo "<table cellspacing="0" summary="">";
  6. echo " <thead>";
  7. echo " <tr>";
  8. echo" <td>Gospodarz</td><td>Gość</td><td>Wynik</td>";
  9. echo" </tr>";
  10. echo"</thead>";
  11. echo" <tbody>";
  12. while ($row = $db->sql_fetchrow($result2)) {
  13. $gid = intval($row['gid']);
  14. $sid = intval($row['sid']);
  15. $gosp = intval($row['gosp']);
  16. $gosc = intval($row['gosc']);
  17. $daynum = intval($row['daynum']);
  18. echo "<tr>";
  19. $ho=$db->sql_fetchrow($db->sql_query("select name from nuke_league_teams where id=$gosp"));
  20. $home=$ho['name'];
  21. $aw=$db->sql_fetchrow($db->sql_query("select name from nuke_league_teams where id=$gosc"));
  22. $away=$aw['name'];
  23. $buid = $cookie[0];
  24. echo "<input type="hidden" name="buid" value="$buid">";
  25. echo "<input type="hidden" name="gid" value="$gid">";
  26. echo "<input type="hidden" name="daynum" value="$daynum">";
  27. echo "<input type="hidden" name="sid" value="$sid">";
  28. echo "<input type="hidden" name="gosp" value="$gosp">";
  29. echo "<input type="hidden" name="gosc" value="$gosc">";
  30. echo " <td>$home </td><td> $away</td><td>";
  31. echo "<input type="text" name="score1" size="2" maxlength="2" value="?">";
  32. echo "<input type="text" name="score2" size="2" maxlength="2" value="?">";
  33. echo "</td>";
  34. echo"</tr>";
  35. echo"</tbody>";
  36. echo"</table>";
  37. echo "<input type="hidden" name="op" value="addnewplayer">";
  38. echo "<br /><input type="submit" value="Dodaj"></form>";
  39. ?>

i teraz powiedzmy zwraca mi 6 rekordów. po wpisaniu wyniku w dwa oddzielne inputy ( score1 i score2) chce zapisac jedo bazy. No własnie nie wiem jak
tzn wiem że while lub foreach trzeba użyć ale za nie bardzo potrafię jeszcze się nim posługiwać.
czy mam zrobić to tak?
  1. <?php
  2. echo "<input type="text" name="table[$score1]" size="2" maxlength="2" value="?">";
  3. echo "<input type="text" name="table2[$score2]" size="2" maxlength="2" value="?">";
  4. ?>


i teraz to zwykłym while obrobić questionmark.gif:
  1. <?php
  2. reset ($table);
  3. while (list($score1, $gid, $buid, $resztawartości) = each ($table)) {  
  4. //tutaj dam zapytanie do bazy
  5. }
  6. reset ($table2);
  7. while (list($score2, $gid, $buid, $resztawartości) = each ($table2)) {  
  8. //tutaj dam zapytanie do bazy
  9. }
  10. ?>

proszę o podpowiedzi
pozdrawiam