prepare("INSERT INTO todos (description) VALUES (:description)"); $sth->bindValue(':description', $description, PDO::PARAM_STR); $sth->execute(); } # Delete TODO elseif (isset($_POST['delete'])) { $id = $_POST['id']; $sth = $pdo->prepare("delete from todos where id = :id"); $sth->bindValue(':id', $id, PDO::PARAM_INT); $sth->execute(); } # Update completion status elseif (isset($_POST['complete'])) { $id = $_POST['id']; $sth = $pdo->prepare("UPDATE todos SET complete = 1 where id = :id"); $sth->bindValue(':id', $id, PDO::PARAM_INT); $sth->execute(); } # Here is the HTML: ?> Todo List

Todo List

Current Todos

prepare("SELECT * FROM todos ORDER BY id DESC"); $sth->execute(); foreach ($sth as $row) { # Exiting PHP Mode ?>
Task
Task Complete!