Advertisement
Guest User

Untitled

a guest
Nov 1st, 2017
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.18 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. table, th, td {
  6.     border: 1px solid black;
  7. }
  8. </style>
  9. </head>
  10. <body>
  11. <div>
  12.     <a style="font-size: 50px" href="login.php">πŸ”™</a>
  13. </div>
  14.  
  15. <?php
  16. $servername = "localhost";
  17. $username = "root";
  18. $password = "admin";
  19. $dbname = "biografiedb";
  20.  
  21. // Create connection
  22. $conn = new mysqli($servername, $username, $password, $dbname);
  23. // Check connection
  24. if ($conn->connect_error) {
  25.     die("Connection failed: " . $conn->connect_error);
  26. }
  27.  
  28. $sql = "SELECT id, full_name, email_adres, bericht FROM oke";
  29. $result = $conn->query($sql);
  30.  
  31. if ($result->num_rows > 0) {
  32.     echo "<table><tr><th>ID</th><th>Name</th><th>Email</th><th>Bericht</th></tr>";
  33.     // output data of each row
  34.     while($row = $result->fetch_assoc()) {
  35.         echo "<tr><td>" . $row["id"]. "</td><td>" . $row["full_name"]. "</td><td>" . $row["email_adres"]."</td><td>" . $row["bericht"]. "</td> . </tr>";
  36.     }
  37.     echo "</table>";
  38. } else {
  39.     echo "0 results";
  40. }
  41.  
  42. $conn->close();
  43. ?>
  44.  
  45. </body>
  46. </html>
  47.  
  48.  
  49. ------------------------------------
  50.  
  51.  
  52. <?php
  53.  
  54. if(isset($_POST['full_name'])){
  55.     $servername = "localhost";
  56.     $username = "root";
  57.     $password = "admin";
  58.     $dbname = "biografiedb";
  59.  
  60.     // Create connection
  61.     $conn = mysqli_connect($servername, $username, $password, $dbname);
  62.     // Check connection
  63.     if (!$conn) {
  64.         die("Connection failed: " . mysqli_connect_error());
  65.     }
  66.  
  67.     $sql = "INSERT INTO oke (full_name, email_adres, bericht)
  68.     VALUES ('".$_POST['full_name']."', '".$_POST['email_adres']."', '".$_POST['bericht']."')";
  69.  
  70.     if (mysqli_query($conn, $sql)) {
  71.         echo "New record created successfully";
  72.     } else {
  73.         echo "Error: " . $sql . "<br>" . mysqli_error($conn);
  74.     }
  75.  
  76.     mysqli_close($conn);
  77. }
  78. ?>
  79.  
  80. <html>
  81. <head>
  82.     <title></title>
  83.     <link rel="stylesheet" type="text/css" href="style.css">
  84. </head>
  85. <body class="bodycontact">
  86.     <header>
  87.         <div>
  88.             <h1 class="h1">
  89.                 <a href="index.php">JEFFREY ROERING</a>
  90.             </h1>
  91.         </div>
  92.         <div>
  93.             <h3 class="h3">
  94.                 <a href="biografie.php">BIOGRAFIE</a>
  95.                 <a href="contact.php">CONTACT</a>
  96.                 <a href="login.php">AANMELDEN</a>
  97.             </h3>          
  98.         </div>
  99.         <br/><br/>
  100.  
  101.         <div>
  102.             <div class="blurb">
  103.                 <div style=''>
  104.                 <form class="formcontact" action="contact.php" method="post">
  105.                     <fieldset style="text-align:">
  106.                     <legend>Contact Jeffrey Roering</legend>
  107.  
  108.                    
  109.                     <label for="full_name">Naam:</label>
  110.                                 <input class="contactinput" type="text" name="full_name"/>
  111.                                 <br/><br/>
  112.                     <label for="email_adres">Uw email:</label>
  113.                                 <input class="contactinput" type="text" name="email_adres"/>
  114.                     <br/><br/>
  115.                                 <label for="bericht">Bericht:</label>
  116.                                 <textarea name="bericht" cols="49" rows="6"></textarea>
  117.                     <br/><br/>
  118.                     <!--<select>
  119.                                     <option>2017</option>
  120.                                     <option>2018</option>
  121.                                     <option>2019</option>
  122.                                 </select>
  123.                                 <br/><br/>-->
  124.                     <input class="button button1" type='submit' name='submit' value='Send' />
  125.                     <br/>
  126.                     </fieldset>
  127.                 </form>
  128.             </div>
  129.         </div>
  130.  
  131.     </header>
  132. </body>
  133. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement