Advertisement
Guest User

Untitled

a guest
May 26th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <?php
  3. $host = "localhost";
  4. $username = "root";
  5. $password = "";
  6. $baza = "lab11";
  7.  
  8. $conn = @new mysqli($host, $username, $password, $baza);
  9. if ($conn->connect_error) {
  10. die('wystapil blad podczas laczenia: ' . $conn->connect_errno);
  11. }
  12. $conn->query("set names utf8");
  13. ?>
  14. <html lang="en">
  15. <head>
  16. <meta charset="UTF-8">
  17. <title>Dodaj nowy post</title>
  18. </head>
  19. <body>
  20.  
  21. <form method="post" action="insertPost.php">
  22. Tytuł: <input title="Tytuł" name="title" type="text"/><br/>
  23. Kategoria:
  24. <select title="Kategoria" name="cat">
  25. <?php
  26. $sql = "select * from kategorie";
  27. $result = $conn->query($sql);
  28. while ($row = $result->fetch_assoc()):?>
  29. <option value="<?=$row['id']?>"><?=$row['nazwa']?></option>
  30. <?php
  31. endwhile;
  32. ?>
  33. </select><br/>
  34. Treść: <br/><textarea title="Tresc" cols="100" rows="10" name="content"></textarea><br/>
  35. <input type="submit" value="Wyslij"><br/>
  36. </form>
  37.  
  38. </body>
  39. </html>
  40. <?php
  41. $conn->close();
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement