Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Gdzie jest błąd? pętle
shpaque
post
Post #1





Grupa: Zarejestrowani
Postów: 651
Pomógł: 3
Dołączył: 31.01.2011
Skąd: Warszawa

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


nie zapisuje plików z formularza, co więcej czysci cały plik csv

  1. <?php
  2.  
  3. ini_set("display_errors", 1);
  4.  
  5. $getdate = $_GET['datein'];
  6. $getcity = $_GET['city'];
  7.  
  8. $dateins = array();
  9. $dateouts = array();
  10. $titles = array();
  11. $programs = array();
  12. $citys = array();
  13. $streets = array();
  14. $places = array();
  15. $seats = array();
  16. $userss = array();
  17.  
  18. $database = './../db/events.csv';
  19. $items = file($database);
  20. $count = 0;
  21. $kodindex = -1;
  22. foreach($items as $line)
  23. {
  24. list($datein, $dateout, $title, $program, $city, $street, $place, $seat, $users) = explode('|', trim($line));
  25. $dateins[$count] = $datein;
  26. $dateouts[$count] = $dateout;
  27. $titles[$count] = $title;
  28. $programs[$count] = $program;
  29. $citys[$count] = $city;
  30. $streets[$count] = $street;
  31. $places[$count] = $place;
  32. $seats[$count] = $seat;
  33. $userss[$count] = $users;
  34.  
  35. if ($getdate == $datein && $getcity == $city)
  36. {
  37. $kodindex = $count;
  38. }
  39. $count++;
  40. }
  41. $file = fopen($database, 'r');
  42. for ($i = 0; $i < $count; $i++)
  43. {
  44. if ($i == $kodindex)
  45. {
  46. $datein = $dateins[$i];
  47. $dateout = $dateouts[$i];
  48. $title = $titles[$i];
  49. $program = $programs[$i];
  50. $city = $citys[$i];
  51. $street = $streets[$i];
  52. $place = $places[$i];
  53. $seat = $seats[$i];
  54. $users = $userss[$i];
  55. }
  56. }
  57. fclose($file);
  58.  
  59. if ($_SERVER['REQUEST_METHOD'] == 'POST')
  60. {
  61. $action = isset($_POST['action']) ? $_POST['action'] : '';
  62. if ($action == "update")
  63. {
  64. $newdatein = $_POST['datein'];
  65. $newdateout = $_POST['dateout'];
  66. $newtitle = $_POST['title'];
  67. $newprogram = $_POST['program'];
  68. $newcity = $_POST['city'];
  69. $newstreet = $_POST['street'];
  70. $newplace = $_POST['place'];
  71. $newseat = $_POST['seat'];
  72. $newusers = implode(',', $user[$x]);
  73.  
  74. $file = fopen($database, 'w');
  75. for ($z = 0; $z < $count; $z++)
  76. {
  77. if ($z == $i)
  78. {
  79. fwrite($file, "".$newdatein."|".$newdateout."|".$newtitle."|".$newprogram."|".$newcity."|".$newstreet."|".$newplace."|".$newseat."|".$$newusers."\r\n");
  80. }
  81. }
  82. fclose($file);
  83. header('Location: admin.php');
  84. }
  85. }
  86. ?>


wywala tak:

[htmlNotice: Undefined index: datein in /home/smusic/ftp/_uniwersytetrodzica/php/admin-edit.php on line 67

Notice: Undefined index: dateout in /home/smusic/ftp/_uniwersytetrodzica/php/admin-edit.php on line 68

Notice: Undefined index: title in /home/smusic/ftp/_uniwersytetrodzica/php/admin-edit.php on line 69

Notice: Undefined variable: x in /home/smusic/ftp/_uniwersytetrodzica/php/admin-edit.php on line 75

Notice: Undefined index: in /home/smusic/ftp/_uniwersytetrodzica/php/admin-edit.php on line 75

Warning: implode() [function.implode]: Invalid arguments passed in /home/smusic/ftp/_uniwersytetrodzica/php/admin-edit.php on line 75

Warning: Cannot modify header information - headers already sent by (output started at /home/smusic/ftp/_uniwersytetrodzica/admin/aedit.php:37) in /home/smusic/ftp/_uniwersytetrodzica/php/admin-edit.php on line 86[/html]
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: 23.08.2025 - 20:55