PHP OOP NOT ADDING
983
Im trying to create a to-do list following a tutorial from phpacademy. Iv managed to get everything to work, accept for submitting the user input into the database. This is my code so far.
<?php
require 'init.php';
if(isset($_POST['submit'])){
$name = trim($_POST['name']);
if(!empty($name)) {
$query = $db->prepare("
INERT INTO items (name,done) VALUES (:name,0)
");
$query->execute([
'name' => $name
]);
}
}
else {
echo ' not submitted';
} ?>
Answer
Solution:
Try this way to fix your typo
INSERT
and:name