// define variables and set to empty values $topic = $description = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $topic = test_input($_POST["topic"]); $description = test_input($_POST["description"]); } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } $new_forum_topic = new ForumPost(); $new_forum_topic->createNew(array('category_title' => $topic, 'category_description' => $description)); $new_forum_topic->register(); $allposts = forumPost::getallForum(); foreach ($allposts as $key => $value) { $title = $value->get_Title(); $des = $value->get_Description(); echo "<a href='#' class='cat_links'> <b>{$title}</b> : <hr> <br><i>{$des}</i></a><br> "; } ?> </div> </div> <?php include "includes/footer.php";