Guest User

Untitled

a guest
May 20th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <form action="wyswietl.php" method="post">
  2.  
  3. Nick: <input type="text" name="name" /><br />
  4.  
  5. Data: <input type="text" name="date" /><br />
  6.  
  7. E-Mail: <input type="text" name="mail" /><br />
  8.  
  9. Treść: <input type="text" name="wiadomosc" /><br />
  10.  
  11. <input type="submit" value="Wyslij" />
  12.  
  13. </form>
  14.  
  15.  
  16.  
  17. <?php
  18.  
  19. include('config.php');
  20.  
  21. $name = ($_POST['name']);
  22.  
  23. $date = ($_POST['date']);
  24.  
  25. $mail = ($_POST['mail']);
  26.  
  27. $wiadomosc = ($_POST['wiadomosc']);
  28.  
  29. $sql = mysql_connect ($host, $login, $passwd) or die('Brak połączenia z serwerem MySQL');
  30.  
  31. mysql_select_db("$database");
  32.  
  33.  
  34.  
  35. if (empty($_POST['name']) && empty($_POST['date']) && empty($_POST['mail']) && empty($_POST['wiadomosc'])) {
  36.  
  37. echo ('<h5>Wypełnij wszystkie pola!</h5>');
  38.  
  39. } else {
  40.  
  41. $zapytanie = "INSERT INTO `Comments` (`id`, `name`, `date`, `mail` , `wiadomosc`) VALUES ('null','$name', '$date', '$mail', '$wiadomosc')";
  42.  
  43. $idzapytania = mysql_query($zapytanie);
  44.  
  45. }
  46.  
  47. ?>
  48.  
  49.  
  50.  
  51. <a href="wyswietl.php">Wyswietl newsy</a>
Add Comment
Please, Sign In to add comment