Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include_once("../include/scripts/administration_check.php"); ?>
- <?php
- // Parse the form data and add inventory item to the system
- if (isset($_POST['title'])) {
- $pid = mysql_real_escape_string($_POST['thisID']);
- $title = mysql_real_escape_string($_POST['title']);
- $post = mysql_real_escape_string($_POST['post']);
- // See if that product name is an identical match to another product in the system
- $sql = mysql_query("UPDATE blog_posts SET id='$pid', title='$title', post='$post'");
- header("location: blog_list.php");
- exit();
- }
- ?>
- <?php
- // Gather this product's full information for inserting automatically into the edit form below on page
- if (isset($_GET['pid'])) {
- $targetID = $_GET['pid'];
- $sql = mysql_query("SELECT * FROM blog_posts WHERE id='$targetID' LIMIT 1");
- $blog_posts = mysql_num_rows($sql); // count the output amount
- if ($blog_posts > 0) {
- while($row = mysql_fetch_array($sql)){
- $id = $row["id"];
- $title = $row["title"];
- $post = $row["post"];
- $date_posted = strftime("%b %d, %Y", strtotime($row["date_posted"]));
- }
- } else {
- $blog_posts = "You haven't posted any posts yet";
- }
- }
- ?>
- <?php include_once("../include/templete/header.php");?>
- <div id="Content"><br />
- <div id="pageContent">
- <div align="right" style="margin-right:32px;"><a href="blog_list.php#blogForm">+ Add New Inventory Item</a></div>
- <div align="left" style="margin-left:24px;">
- <h2>Blog History</h2>
- <?php echo $blog_posts; ?>
- </div>
- <hr />
- <a name="blogForm" id="inventoryForm"></a>
- <h3>
- ↓ Blog Post Editor ↓
- </h3>
- <form action="blog_edit.php" enctype="multipart/form-data" name="myForm" id="myform" method="post">
- <table width="90%" border="0" cellspacing="0" cellpadding="6">
- <tr>
- <td width="20%" align="right">Blog Title</td>
- <td width="80%"><label>
- <input name="title" type="text" id="title" size="64" value="<?php echo $title; ?>" />
- </label></td>
- </tr>
- <tr>
- <td align="right">Post Detials</td>
- <td><label>
- <textarea name="post" id="post" cols="64" rows="5"><?php echo $post; ?></textarea>
- </label></td>
- </tr>
- <tr>
- <td> </td>
- <td><label>
- <input name="thisID" type="hidden" value="<?php echo $targetID; ?>" />
- <input type="submit" name="button" id="button" value="Make Changes" />
- </label></td>
- </tr>
- </table>
- </form>
- <br />
- <br />
- </div>
- <?php include_once("../include/templete/footer.php"); ?>
Add Comment
Please, Sign In to add comment