Guest User

Untitled

a guest
Feb 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. <?php include_once("../include/scripts/administration_check.php"); ?>
  2.  
  3. <?php
  4. // Parse the form data and add inventory item to the system
  5. if (isset($_POST['title'])) {
  6.  
  7. $pid = mysql_real_escape_string($_POST['thisID']);
  8. $title = mysql_real_escape_string($_POST['title']);
  9. $post = mysql_real_escape_string($_POST['post']);
  10. // See if that product name is an identical match to another product in the system
  11. $sql = mysql_query("UPDATE blog_posts SET id='$pid', title='$title', post='$post'");
  12. header("location: blog_list.php");
  13. exit();
  14. }
  15. ?>
  16.  
  17. <?php
  18. // Gather this product's full information for inserting automatically into the edit form below on page
  19. if (isset($_GET['pid'])) {
  20. $targetID = $_GET['pid'];
  21. $sql = mysql_query("SELECT * FROM blog_posts WHERE id='$targetID' LIMIT 1");
  22. $blog_posts = mysql_num_rows($sql); // count the output amount
  23. if ($blog_posts > 0) {
  24. while($row = mysql_fetch_array($sql)){
  25. $id = $row["id"];
  26. $title = $row["title"];
  27. $post = $row["post"];
  28. $date_posted = strftime("%b %d, %Y", strtotime($row["date_posted"]));
  29. }
  30. } else {
  31. $blog_posts = "You haven't posted any posts yet";
  32. }
  33. }
  34. ?>
  35.  
  36. <?php include_once("../include/templete/header.php");?>
  37. <div id="Content"><br />
  38. <div id="pageContent">
  39. <div align="right" style="margin-right:32px;"><a href="blog_list.php#blogForm">+ Add New Inventory Item</a></div>
  40. <div align="left" style="margin-left:24px;">
  41. <h2>Blog History</h2>
  42. <?php echo $blog_posts; ?>
  43. </div>
  44. <hr />
  45. <a name="blogForm" id="inventoryForm"></a>
  46. <h3>
  47. &darr; Blog Post Editor &darr;
  48. </h3>
  49. <form action="blog_edit.php" enctype="multipart/form-data" name="myForm" id="myform" method="post">
  50. <table width="90%" border="0" cellspacing="0" cellpadding="6">
  51. <tr>
  52. <td width="20%" align="right">Blog Title</td>
  53. <td width="80%"><label>
  54. <input name="title" type="text" id="title" size="64" value="<?php echo $title; ?>" />
  55. </label></td>
  56. </tr>
  57. <tr>
  58. <td align="right">Post Detials</td>
  59. <td><label>
  60. <textarea name="post" id="post" cols="64" rows="5"><?php echo $post; ?></textarea>
  61. </label></td>
  62. </tr>
  63. <tr>
  64. <td>&nbsp;</td>
  65. <td><label>
  66. <input name="thisID" type="hidden" value="<?php echo $targetID; ?>" />
  67. <input type="submit" name="button" id="button" value="Make Changes" />
  68. </label></td>
  69. </tr>
  70. </table>
  71. </form>
  72. <br />
  73. <br />
  74. </div>
  75. <?php include_once("../include/templete/footer.php"); ?>
Add Comment
Please, Sign In to add comment