Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Problem Option
Neon12345
post
Post #1





Grupa: Zarejestrowani
Postów: 74
Pomógł: 0
Dołączył: 2.04.2010
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Witam otóż mam pewien problem z <select><option></option></select>

Plik squad.php

  1. <?php
  2.  
  3. $connection = @mysql_connect('127.0.0.1', 'xx', 'xx');
  4. $db = @mysql_select_db('xx', $connection);
  5.  
  6. $zalozyciel = 461;
  7. $bramkarze = mysql_query("select * from team_position where zalozyciel = $zalozyciel and pozycja = 'bramkarz'") or die(mysql_error());
  8. $skrzydlowi = mysql_query("select * from team_position where zalozyciel = $zalozyciel and pozycja = 'skrzydlowy'") or die(mysql_error());
  9. $obrotowi = mysql_query("select * from team_position where zalozyciel = $zalozyciel and pozycja = 'obrotowy'") or die(mysql_error());
  10. $rozgrywajacy = mysql_query("select * from team_position where zalozyciel = $zalozyciel and pozycja = 'rozgrywajacy'") or die(mysql_error());
  11.  
  12. echo '<table>';
  13. echo '<form method="post"><div ><tr>';
  14. echo '<td><select name="bramkarze">';
  15. while($bra = mysql_fetch_array($bramkarze)){
  16.  
  17. echo '<option value="'.$bra['user'].'">'.$bra['user'].'</option></select></td></tr>';
  18.  
  19. }
  20. echo '<br ></div></form>';
  21. echo '</table>';
  22. echo '<table>';
  23. echo '<form method="post"><div ><tr>';
  24. echo '<td><select name="skrzydlowi">';
  25. while($skrz = mysql_fetch_array($skrzydlowi)){
  26.  
  27. echo '<option value="'.$skrz['user'].'">'.$skrz['user'].'</option></select></td></tr>';
  28.  
  29. }
  30. echo '<br ></div></form>';
  31. echo '</table>';
  32. echo '<table>';
  33. echo '<form method="post"><div ><tr>';
  34. echo '<td><select name="obrotowi">';
  35. while($obr = mysql_fetch_array($obrotowi)){
  36.  
  37. echo '<option value="'.$obr['user'].'">'.$obr['user'].'</option></select></td></tr>';
  38.  
  39. }
  40. echo '<br ></div></form>';
  41. echo '</table>';
  42. echo '<table>';
  43. echo '<form method="post"><div ><tr>';
  44. echo '<td><select name="rozgrywajacy">';
  45. while($roz = mysql_fetch_array($rozgrywajacy)){
  46. echo '<option value="'.$roz['user'].'">'.$roz['user'].'</option></select></td></tr>';
  47.  
  48. }
  49. echo '<br ></div></form>';
  50. echo '</table>';
  51.  
  52. ?>


Mianowice chodzi o to że w polu opiton wyskakuje tylko 1 rekord a reszta jest po za nim . Przykład

www.handball-manager.pl/squad.php

Gdzie tutaj jest błąd?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
Pawel_W
post
Post #2





Grupa: Zarejestrowani
Postów: 1 675
Pomógł: 286
Dołączył: 15.06.2009
Skąd: Wieliczka

Ostrzeżenie: (0%)
-----


  1. while($bra = mysql_fetch_array($bramkarze)){
  2.  
  3. echo '<option value="'.$bra['user'].'">'.$bra['user'].'</option></select></td></tr>';
  4.  
  5. }
  6. echo '<br ></div></form>';

zamień to na
  1. while($bra = mysql_fetch_array($bramkarze)){
  2.  
  3. echo '<option value="'.$bra['user'].'">'.$bra['user'].'</option>';
  4.  
  5. }
  6. echo '</select></td></tr><br ></div></form>';

i trochę pomyśl zanim coś napiszesz... wystarczyło popatrzyć w kod strony guitar.gif
Go to the top of the page
+Quote Post
Neon12345
post
Post #3





Grupa: Zarejestrowani
Postów: 74
Pomógł: 0
Dołączył: 2.04.2010
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Rzeczywiście ! Bardzo dziękuje .
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 11:25