Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Opdracht 2</title>
  6. </head>
  7.  
  8. <body>
  9. <?php
  10. $dbhost = "localhost";
  11. $dbuser = "root";
  12. $password = "";
  13. $dbname = "lessenphp";
  14.  
  15. $connect = new mysqli($dbhost, $dbuser, $password, $dbname);
  16.  
  17. if ($connect->connect_error) {
  18. die("Connection failed: " . $connect->connect_error);
  19. }
  20.  
  21. echo "Connected successfully";
  22.  
  23. if (isset($_POST['submit'])) {
  24. $vak = $_POST['vak'];
  25. $docent = $_POST['docent'];
  26. $periode = $_POST['periode'];
  27. $cijfer = $_POST['cijfer'];
  28. $query = "INSERT INTO rapporten('Vak', 'Docent', 'Cijfer', 'Periode') VALUES('$vak', '$docent', '$periode', '$cijfer')";
  29. mysqli_query($connect, $query);
  30. }
  31. ?>
  32.  
  33. <form method="post">
  34.     <table>
  35.         <tr><td>Vak:</td>
  36.             <td><input type="text" name="vak"></td></tr>
  37.  
  38.         <tr><td>Docent:</td>
  39.             <td><input type="text" name="docent"></td></tr>
  40.  
  41.         <tr><td>Periode:</td>
  42.             <td><input type="text" name="periode"></td></tr>
  43.  
  44.         <tr><td>Cijfer:</td>
  45.             <td><input type="text" name="cijfer"></td></tr>
  46.  
  47.         <tr><td><input type="submit" name="submit" value="Verzenden"></td></tr>
  48.     </table>
  49. </form>
  50.  
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement