$ca = new Category();
$story = $db->select($st->getStoryById($id))->fetch_assoc();
$categories = $db->select($ca->getAllCategories());
// if submit button is pressed
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;
?>
">