Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [MySQL][PHP]nie zapisuje !
Forum PHP.pl > Forum > Przedszkole
bartek4175
Mam błąd nie zapisuje do bazy danych!!!


Oto Kod:

  1. <?php
  2. require_once ('szkielet.php');
  3. ?>
  4. <center>
  5. <?
  6. $user = user::getData('', '');
  7. $errors = '';
  8. //formularz
  9. ?>
  10. <form method="post" action="">
  11. <input type="hidden" name="od" value="'.$user['login'].'" />
  12.  
  13.  
  14. <label for="pass">Do kogo wyslac wiadomosc:</label>
  15. <input maxlength="32" type="text" name="do" id="do" />
  16.  
  17. <label for="pass_again">Temat:</label>
  18. <input maxlength="32" type="text" name="tytul" id="tytul" />
  19.  
  20. <label for="email">Tresc:</label>
  21. <textarea name="wiadomosc" cols="17" rows="6"></textarea><br>
  22.  
  23.  
  24. <input type="hidden" name="stan" value="nie_odebrany" />
  25. <input type="hidden" name="send" value="1" />
  26. <input type="submit" value="Wyslij" />
  27.  
  28.  
  29.  
  30. </form>
  31. </center>
  32. <?php
  33. if ($_POST['send'] == 1) {
  34. $temat = mysql_real_escape_string(htmlspecialchars($_POST['tytul']));
  35. $tresc = mysql_real_escape_string(htmlspecialchars($_POST['wiadomosc']));
  36. $stan = mysql_real_escape_string(htmlspecialchars($_POST['stan']));
  37.  
  38. if ($errors != '') {
  39. echo '<center><font color="red"> Wystapil Blad!</font></center>';
  40.  
  41. }
  42. else{
  43. mysql_query("INSERT INTO wiadomosci (od, do, tytul, wiadomosc, stan) VALUES('$od','$do','$temat', '$tresc', '$stan');") or die('BŁĄD:'.mysql_error());
  44. echo '<center><font color="green">Wiadomosc wyslana poprawnie!</font></center>';
  45. }
  46. }
  47.  
  48.  
  49. require_once ('stopka.php');


Nic nie wyświetla - żadnego błędu ale do bazy nie dodaje !

Proszę o pomoc!
Mackos
Hmm... no może dlatego że cały czas wykonuje się to co jest w ifie:
  1. if ($_POST['send'] == 1)

A nie w else.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.