$db = new Database();
$ca = new Category();
$st = new Story();
$categories = $db->select($ca->getAllCategories());
if (isset($_POST['submit'])) {
    //assign post variables
    $title = mysqli_real_escape_string($db->link, $_POST['title']);
    $body = mysqli_real_escape_string($db->link, $_POST['body']);
    $category = mysqli_real_escape_string($db->link, $_POST['category']);
    $author = mysqli_real_escape_string($db->link, $_POST['author']);
    // simple validation
    if ($title == '' || $body == '' || $category == '' || $author == '') {
        // set error
        $error = 'Please fill out all required fields.';
    } else {
        $insert_row = $db->insert($st->setStory($submitter, $category, $title, $author, $body));
    }
}
?>

<h2 class="page-header">Add Story</h2>
<form method="post" action="add_story.php">
  <div class="form-group">
    <label>Story Title</label>
    <input name="title" type="text" class="form-control" placeholder="Enter title">
  </div>
  <div class="form-group">
    <label>Story Body</label>
    <textarea name="body" class="form-control" placeholder="Enter story"></textarea>
  </div>
  <div class="form-group">