Advertisement
Guest User

Untitled

a guest
Jan 29th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html><head>
  3.  
  4. <meta http-equiv="Content-type" content="text/html; charset=ISO-8859-2">
  5. <title>SPI - Anna Kubicka</title>
  6. <link rel="stylesheet" type="text/css" href="styl1.css" />
  7. <link rel="Shortcut icon" href="favicon.gif" />
  8. <link href="styl1.css" rel="stylesheet" type="text/css">
  9. </head>
  10. <body>
  11.  
  12. <header id="main-header1" >
  13. <div class="menu_1080">
  14. <div class="logo_1080">
  15. <a href="file:///C:/Users/ashanej/Desktop/strona%20www/druga%20strona/strona.html">
  16. <img width="90px" height="auto" src="logo2.png">
  17. </a>
  18. </div>
  19. <div id="top-navigatiob" >
  20. <a href="index.php" class="menulink"><img src="homeico.png" width="15px" height="15px"/> HOME</a><a href="zainteresowania.php" class="menulink"><img src="za.png" width="15px" height="15px" /> Zainteresowania</a><a href="formularz.php" class="menulink"><img src="form.png" width="15px" height="15px" /> Formularz</a><a href="baza.php" class="menulink">Baza</a></div></div>
  21. </div>
  22. </header>
  23. <div id="nowy">
  24. <div class="nagloweknaglownej"> Dodaj do bazy </div>
  25.  
  26. </div>
  27. <?php
  28.  
  29.  
  30. $servername = "localhost";
  31. $username = "kubicka";
  32. $password = "gth04056";
  33. $dbname = "kubicka";
  34.  
  35. // Create connection
  36. $conn = new mysqli($servername, $username, $password, $dbname);
  37. // Check connection
  38. if ($conn->connect_error) {
  39. die("Connection failed: " . $conn->connect_error);
  40. }
  41.  
  42.  
  43. $format = 'd.m.Y';
  44. $imie = $_POST['imie'];
  45. $imie_drugie = $_POST['imie_drugie'];
  46. $nazwisko = $_POST['nazwisko'];
  47. $data_ur = (date("d-m-Y", time())) $_POST['data_ur'];
  48. $plec = $_POST['plec'];
  49. $liczba_ocen = (int) $_POST['liczba_ocen'];
  50. $sql = "INSERT INTO studenci (imie, imie_drugie, nazwisko, data_ur, plec, liczba_ocen)
  51. VALUES ('$imie', '$imie_drugie', '$nazwisko' ,'$data_ur' , '$plec' , '$liczba_ocen')";
  52.  
  53. if(empty($imie) || empty($nazwisko)|| empty($data_ur))
  54. {
  55. echo('BŁĄD!! Nie wypełniłeś wszystkich pól!');
  56. exit;
  57. }
  58. if(empty($liczba_ocen))
  59. {
  60. echo('Pole: Liczba ocen musi być liczbą!');
  61. exit;
  62. }
  63. if(empty($data_ur))
  64. {
  65. echo('Pole: Data urodz');
  66. exit;
  67. }
  68.  
  69. if ($conn->query($sql) === TRUE) {
  70. echo '<div id="witaj">Pomyślnie dodano do bazy!</div>';
  71. } else {
  72. echo "Error: " . $sql . "<br>" . $conn->error;
  73. }
  74.  
  75. ?>
  76.  
  77. <footer id="main-footer">
  78.  
  79.  
  80.  
  81. <div id="footer">
  82. <div class="footer2">
  83. <p id="footer-info">Made by Anna Kubicka | <b>ĹšRODOWISKO PRACY INFORMATYKA</b> </p>
  84. </div>
  85. </div>
  86. </footer>
  87.  
  88.  
  89. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement