Olive Branch MS Chamber of Commerce (circa Oct 1999)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

99 lines
4.1 KiB

  1. <?php // form for editing page propeties
  2. require("../db.php3");
  3. // connect to the db and retrieve our page data
  4. $connection = connect($host, $dbname);
  5. if($connection) {
  6. $query = "select * from page where id=$pid";
  7. $result = query($connection, $query);
  8. $page = fetch_object($result, 0);
  9. // include a page header
  10. include("intro.php3");
  11. // stuff the db query into an html comment
  12. print("<!--\n page query = $query\n-->\n");
  13. print("<div class=center>\n");
  14. // the form begins
  15. print("<form name=pageprop action=page_update.php3 method=post>\n");
  16. // the table begins
  17. print("<table border=1 cellspacing=0 cellpadding=4>\n");
  18. print("<tr class=header>\n <th colspan=3>Page Title</th>\n ");
  19. print("<th colspan=2>Background Image</th></tr>\n");
  20. // title and bgimage data elements
  21. print("<tr class=dark>\n ");
  22. print("<td colspan=3><input type=text name=title size=42 ");
  23. print("maxlength=40 value=\"$page->title\"></td>\n ");
  24. print("<td colspan=2><input type=text name=bgimage size=27 ");
  25. print("maxlength=30 value=\"$page->bgimage\"></td></tr>\n");
  26. // second row of headers
  27. print("<tr class=header>\n <th>Stylesheet</th>\n <th>Base Target</th>\n ");
  28. print("<th>Prev</th>\n <th>Next</th>\n <th>Footer</th></tr>\n");
  29. print("<tr class=dark>\n ");
  30. // second row of data elements
  31. print("<td><input type=text name=style size=12 maxlength=30 ");
  32. print("value=\"$page->style\"></td>\n ");
  33. print("<td><input type=text name=target size=12 maxlength=30 ");
  34. print("value=\"$page->target\"></td>\n ");
  35. print("<td><input type=text name=prev size=12 maxlength=30 ");
  36. print("value=\"$page->prev\"></td>\n ");
  37. print("<td><input type=text name=next size=12 maxlength=30 ");
  38. print("value=\"$page->next\"></td>\n ");
  39. print("<td><input type=text name=footer size=12 maxlength=30 ");
  40. print("value=\"$page->footer\"></td></tr>\n");
  41. print("<input type=hidden name=pid value=$pid>\n");
  42. // buttons for updating page properties
  43. print("<tr class=light>\n <td colspan=5 class=\"center\">\n ");
  44. // reset button
  45. print("<a href=\"page_edit.php3?pid=$pid\">");
  46. print("<img src=\"btn.php3?label=Reset\" name=Reset border=0></a>\n ");
  47. // update button
  48. print("<input type=image src=\"btn.php3?label=Update\" ");
  49. print("name=submit border=0>\n ");
  50. // page list button
  51. print("<a href=\"index.php3\"><img src=\"btn.php3?label=Page+List\" ");
  52. print("alt=\"Page List\" border=0></a></td></tr>\n</form>\n");
  53. // free the initial db query
  54. free_result($result);
  55. // query for page items
  56. $query2 = "select * from item where pid=$pid order by ord";
  57. $result = query($connection, $query2);
  58. $count = numrows($result);
  59. print("<!--\n item query = $query2\n-->\n");
  60. print("<tr><th colspan=5>Page Items</th></tr>\n");
  61. if($count) {
  62. $shade = "light";
  63. for($row=0; $row<$count; $row++) {
  64. $item = fetch_object($result, $row);
  65. $ord = $item->ord;
  66. $alt = (($item->alt) ? $item->alt : " &nbsp ");
  67. print("<tr class=$shade>\n ");
  68. print("<td class=center>\n ");
  69. print("<form action=item_edit.php3 method=post>\n ");
  70. print("<input type=hidden name=id value=$item->id>\n ");
  71. print("<input type=hidden name=pid value=$item->pid>\n ");
  72. print("<input type=image src=\"btn.php3?width=40&label=Edit\" ");
  73. print("name=\"Edit Item $ord\" border=0>\n ");
  74. print("<a href=\"item_delete.php3?id=$item->id&pid=$pid\">");
  75. print("<img src=\"btn.php3?width=40&label=Del\" ");
  76. print("alt=\"Delete Item $ord\" border=0></a>\n ");
  77. print("<td>Item $ord - $item->type</td><td colspan=3>$alt</td></tr>");
  78. print("</form>\n");
  79. $shade = (($row & 1) ? "light" : "dark");
  80. }
  81. }
  82. // new item button
  83. $ord++;
  84. print("<tr class=$shade>\n <td colspan=5 class=\"center\">");
  85. print("<a href=\"item_edit.php3?pid=$pid&ord=$ord\">");
  86. print("<img src=\"btn.php3?label=New+Item\" ");
  87. print("alt=\"New Item\" border=0></a></td></tr>\n");
  88. print("</table>\n</div>\n");
  89. // include footer
  90. print("<br clear=all>\n<div class=\"footer\">\n<hr>\n");
  91. require("../footer.php3");
  92. print("</body>\n</html>");
  93. } else {
  94. print("<div class=center>\n<h2>Database Error</h2>\n");
  95. print("<h2>Failed to connect to database: $dbname</h2>\n");
  96. }
  97. ?>