Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> form method='post' PROBLEM
Soulast
post 2.11.2010, 13:27:49
Post #1





Grupa: Zarejestrowani
Postów: 133
Pomógł: 6
Dołączył: 26.10.2009

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


Napisałem oto taki kod :

  1. <form method='post'>
  2. <table class='ucp_fields' cellpadding='4' cellspacing='3' border='0' align='center' width='95%'>
  3. <tr valign='top'>
  4. <td colspan='2' class='optiontitle' align='center'>Edycja Grupy</td>
  5. </tr>";
  6.  
  7. $sql = mysql_query("SELECT * FROM groups'");
  8. while ($groups = mysql_fetch_array($sql)){
  9.  
  10. echo"
  11. <tr>
  12. <td colspan='2'>Group $groups[groupid] </td>
  13. </tr>
  14.  
  15. <tr>
  16. <td>Wiadomości: </td>
  17. <td><input type='text' name='gr[news]' maxlength='50' size='55' /></td>
  18. </tr>
  19.  
  20. <input type='hidden' name='gr[groupid]' value='$groups[groupid]'><br><br>";
  21. }
  22.  
  23. echo"
  24. <tr valign='top'>
  25. <td class='alt1 smallfont' align='center' height='35' valign='middle'>
  26. <input type='hidden' name='act' value='update_group'>
  27. <input type='submit' name='gr[submit]' value='Update Groups' />
  28. </td>
  29. </tr>
  30. </table>
  31. </form>
  32.  
  33. ////////--------Wysyłam takim Kodem --------------------------////////
  34.  
  35. function update_group($gr){
  36.  
  37. $sql = mysql_query("UPDATE groups SET news= '$gr[news]' WHERE groupid = '$gr[groupid]'")or die(mysql_error());
  38.  
  39. }
  40.  
  41. ///////---------------- Gdzie switch do tego To------------------------------------///////////
  42.  
  43. switch ($act)
  44. {
  45. case "update_group":
  46. update_group($gr);
  47. break;
  48. }
  49.  


W tabeli są 4 grupy i niestety nie wychodzi mi UPDATE wszystkich grup za jednym przyciskiem.
Obecnie w tym kodzie działa jedynie UPDATE tylko pierwszego groupid.

Potrzebuje więc wskazówki pomocy za którą będę bardzo wdzięczny smile.gif

Ten post edytował Soulast 2.11.2010, 13:49:31
Go to the top of the page
+Quote Post

Posty w temacie


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 Wersja Lo-Fi Aktualny czas: 24.07.2025 - 15:37