function getPost($postId) { $post = fetchPost($postId); if ($post == null) { return get404(); } $content = '<p class="topNotification">You are viewing a single blog post. You can go back to view all of my recent <a href="/blog">Blog Posts</a>.</p>'; $content .= '<div class="contentBlock"><h1>' . $post['title'] . '</h1>'; $content .= '<p class="blogPostTagline time">' . date("F jS, Y", strtotime($post['post_date'])) . '</p>'; $content .= '<p class="blogPostTagline tags">' . getTagList($post['id']) . '</p>'; $content .= '<div class="spacer"></div><p class="blogPostOpeneing">' . $post['intro_content'] . '</p>'; $content .= $post['main_content']; $content .= '</div><p class="topNotification">Go back to my most recent <a href="/blog">Blog</a> posts...</p>'; return $content; }
<?php $tags = mysql_query("SELECT * FROM tags;") or die(mysql_error()); while ($tag = mysql_fetch_array($tags)) { echo '<input class="checkbox" type="checkbox" name="tags[]" value="' . $tag['id'] . '">' . $tag['name'] . '<br>'; } ?> <br> <input type="submit" value="Post"> </form> <?php } else { if ($resource2 === "edit") { echo '<a href="/admin/blog"><<< Back to Blog Management</a><br><br>'; if (sizeof($URI) > 0) { $postID = array_shift($URI); $post = fetchPost($postID); $postTags = fetchPostTags($postID); ?> <form action="/admin/editblogpost" method="post"> <table cellspacing=0> <tr><td>Title:</td><td><input type="text" name="title" value="<?php echo $post['title']; ?> "></td></tr> <tr><td>Time Posted:</td><td><input type="text" name="post_date" value="<?php echo $post['post_date']; ?> "></td></tr> <tr><td>Intro Content:</td><td><textarea style="height:200px;" name="intro_content"><?php echo unParse($post['intro_content']); ?>