+ 1

Why will this code not insert

<html> <head> <link rel="stylesheet" href="styless.css"> </head> <body> <div class="header"> <span style="font-size:35px;cursor:pointer"onclick="openNav()" class="left">&#9776;</span> <span style="font-size:35px;cursor:pointer"onclick="openSearch()" class="right">&#128269;</span> <a href="ziekmeldingen.php"> <div id="sidenav" class="sidenav"> <a href="javascript:void(0)" class="closebtn" onclick="closeNav()" class="right">&times;</a> <a href="ziekmeldingen.php">ziekmeldingen docenten</a> <a href="ziekmeldingenadmin.php">admin</a> </div> </div> <div id="sidenav" class="sidenav"> </div> <script> function openNav() { document.getElementById("sidenav").style.width = "750px"; document.getElementById("main").style.marginLeft = "750px"; } function closeNav() { document.getElementById("sidenav").style.width = "0"; document.getElementById("main").style.marginLeft= "0"; } </script> <input type="docenten" name="naam"></br> <input type="status" name="naam"></br> <input type="submit"id="resultaat" value="verzenden"/> </body> </html> <?php // case 1 try { $db = new PDO("mysql:host=localhost;dbname=ziekmeldingen", "root", ""); if(isset($_POST['verzenden'])) { $docenten = filter_input (INPUT_POST, "docenten", FILTER_SANITIZE_STRING); $status = filter_input (INPUT_POST, "status", FILTER_SANITIZE_STRING); $query = $db->prepare("INSERT INTO ziekmelding (docenten,status) VALUES(:docenten, :status)"); $query->bindParam("docenten", $docenten); $query->bindParam("status", $status); if($query->execute()) { echo "De nieuwe gegevens zijn toegevoegd."; } else { echo "Er is een fout opgetreden!"; } echo "<br>"; } } catch(PDOException $e){ die("Error!: " . $e->getMessage()); } ?>

5th Apr 2020, 3:56 PM
Rinish Harpal
Rinish Harpal - avatar
1 ответ
+ 3
Write code on code playground and then insert
10th Apr 2020, 1:36 PM
👑Mahesh Khatri👑
👑Mahesh Khatri👑 - avatar