if (isset($_POST['submit'])) { //assign story variables $category = mysqli_real_escape_string($db->link, $_POST['category']); $title = mysqli_real_escape_string($db->link, $_POST['title']); $author = mysqli_real_escape_string($db->link, $_POST['author']); $body = mysqli_real_escape_string($db->link, $_POST['body']); // simple validation if ($title == '' || $body == '' || $category == '' || $author == '') { // set error $error = 'Please fill out all required fields.'; } else { $update_row = $db->update($st->updateStory($category, $title, $author, $body, $id)); } } if (isset($_POST['delete'])) { $delete_row = $db->delete($st->deleteStory($id)); } ?> <h2 class="page-header">Edit <?php echo $story['Title']; ?> </h2> <form method="post" action="edit_story.php?id=<?php echo $id; ?> "> <div class="form-group"> <label>Story Title</label> <input name="title" type="text" class="form-control" placeholder="Enter title" value="<?php echo $story['Title'];