Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problem z for(); i formularzem
MOniToR
post
Post #1





Grupa: Zarejestrowani
Postów: 182
Pomógł: 2
Dołączył: 16.11.2003
Skąd: Wrocław / Skokowa

Ostrzeżenie: (10%)
X----


Już raz założyłem topic o podobnym problemie, jednak ten jest inny.
  1. if(isset($_GET[\"edit_profil\"])) {
  2. ?><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tbody><tr>
  3. <td colspan=\"4\" background=\"layout/spacer.gif\" height=\"3\" width=\"*\"></td>
  4. </tr><tr>
  5. <td background=\"layout/menu_l.gif\" height=\"25\" width=\"7\"></td>
  6. <td background=\"layout/menu_c.gif\" height=\"25\" nowrap=\"nowrap\" width=\"*\">
  7. <font class=\"title2\">&nbsp;<img src=\"layout/ALL.gif\" border=\"0\">&nbsp;<b>Edycja profilu użytkownika</b>
  8. </td>
  9.  
  10.  </td>
  11. <td background=\"layout/menu_r.gif\" height=\"25\" width=\"6\"></td>
  12. </tr></tbody></table>
  13. <table border=\"0\" cellpadding=\"6\" cellspacing=\"0\" width=\"100%\"><tbody><tr>
  14. <td bgcolor=\"#f9f9f7\" height=\"12\" width=\"*\" ><?
  15. $cat_sql=&#092;"SELECT * 
  16. FROM category
  17.  &#092;";
  18. $cat_result=mysql_query($cat_sql);
  19. echo&#092;"<form method =\"post\" action=\"users.php\" >\";
  20. $ile_kategorii=mysql_num_rows($cat_result);
  21.  
  22. for($i = 1; $i <= $ile_kategorii; $i++) {
  23. $cat_row=mysql_fetch_array($cat_result);
  24.  echo&#092;"<input size=\"8\" type=\"checkbox\" name=\"kat$i\" value=\"\".$cat_row[\"cat_id\"].\":\">\".$cat_row[\"cat_name\"].\"<br>\";
  25.  
  26.  }
  27.  echo&#092;"<input type=\"hidden\" name=\"ile\" value=\"$ile_kategorii\"><br>\";
  28. ?><input size=\"8\" type=\"submit\" name=\"wybierz_kategorie\" value=\"Wybierz\"></form> <br><?
  29.  
  30. } else if(isset($_POST[&#092;"wybierz_kategorie\"])) {
  31.  echo&#092;"kurwa\";
  32. echo $ochrona_klucz;
  33.  
  34.  
  35. if(isset($_COOKIE[&#092;"user_key\"])) {
  36. $klucz=$_COOKIE[&#092;"user_key\"];
  37. } else if(isset($_SESSION[&#092;"user_key\"])) {
  38. $klucz=$_SESSION[&#092;"user_key\"];
  39. }
  40.  
  41.  
  42.  
  43. for($i = 1; $i <= $_POST[&#092;"ile\"]; $i++) {
  44. $uzyt_sql=&#092;"SELECT * 
  45. FROM users
  46.  WHERE user_key='$klucz'&#092;";
  47.  $uzyt_result=mysql_query($uzyt_sql);
  48.  $uzyt_row=mysql_fetch_array($uzyt_result);
  49.  echo $_POST[$kat[$i]];
  50. $sql = &#092;"insert 
  51. into users_cat
  52.  VALUES('\".$uzyt_row[\"user_id\"].\"', '\".$_POST[$kat[$i]].\"')&#092;";
  53.  echo &#092;"$sql<br>\";
  54.  mysql_query($sql);
  55. }
  56. }

Co musze zrobic aby zmienna $_POST[$kat[$i]] zawierała cat_id ? Obecnie jest pusta. Prosze o pomoc.

Ten post edytował MOniToR 7.03.2005, 16:32:12
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 21.12.2025 - 22:17