Advertisement
Guest User

Untitled

a guest
Oct 26th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1.  
  2.  
  3. <form action="index.php" method="post">
  4. imię:<br />
  5. <input type="text" name="imie" /><br />
  6. e-mail:<br />
  7. <input type="text" name="nazwisko" /><br />
  8. <input type="submit" value="dodaj" />
  9. </form>
  10.  
  11. <?php
  12. $imie = $_POST['imie'];
  13. $nazw = $_POST['nazwisko'];
  14.  
  15. if($imie and $nazw) {
  16.  
  17.  
  18. $servername = "localhost";
  19. $username = "root";
  20. $password = "";
  21.  
  22.  
  23.  
  24. $conn = new mysqli($servername, $username, $password);
  25.  
  26. if ($conn->connect_error) {
  27. die("Connection failed: " . $conn->connect_error);
  28. }
  29.  
  30.  
  31.  
  32.  
  33. $sql = "USE test";
  34. $sql1 = "INSERT INTO dane SET imie='$imie', nazwisko='$nazw'";
  35.  
  36. if ($conn->query($sql) && $conn->query($sql1) === TRUE) {
  37. echo "Database created successfully";
  38. } else {
  39. echo "Error creating database: " . $conn->error;
  40. }
  41.  
  42. mysqli_close($conn);
  43. }
  44.  
  45. ?>
  46.  
  47.  
  48.  
  49. </div>
  50. <div id="panel_prawy"><h2> Uczeń:
  51.  
  52. </h2>
  53. <p> Średnia ocen z języka polskiego:
  54. </p>
  55.  
  56. </div>
  57. <div id="stopka"><h3> Zespół Szkół Ponadgimnazjalnych </h3>
  58. <p> Stronę opracował: 00000000001 </p></div>
  59.  
  60.  
  61. </div>
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement