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

<?php // form for editing page propeties
require("../db.php3");
// connect to the db and retrieve our page data
$connection = connect($host, $dbname);
if($connection) {
$query = "select * from page where id=$pid";
$result = query($connection, $query);
$page = fetch_object($result, 0);
// include a page header
include("intro.php3");
// stuff the db query into an html comment
print("<!--\n page query = $query\n-->\n");
print("<div class=center>\n");
// the form begins
print("<form name=pageprop action=page_update.php3 method=post>\n");
// the table begins
print("<table border=1 cellspacing=0 cellpadding=4>\n");
print("<tr class=header>\n <th colspan=3>Page Title</th>\n ");
print("<th colspan=2>Background Image</th></tr>\n");
// title and bgimage data elements
print("<tr class=dark>\n ");
print("<td colspan=3><input type=text name=title size=42 ");
print("maxlength=40 value=\"$page->title\"></td>\n ");
print("<td colspan=2><input type=text name=bgimage size=27 ");
print("maxlength=30 value=\"$page->bgimage\"></td></tr>\n");
// second row of headers
print("<tr class=header>\n <th>Stylesheet</th>\n <th>Base Target</th>\n ");
print("<th>Prev</th>\n <th>Next</th>\n <th>Footer</th></tr>\n");
print("<tr class=dark>\n ");
// second row of data elements
print("<td><input type=text name=style size=12 maxlength=30 ");
print("value=\"$page->style\"></td>\n ");
print("<td><input type=text name=target size=12 maxlength=30 ");
print("value=\"$page->target\"></td>\n ");
print("<td><input type=text name=prev size=12 maxlength=30 ");
print("value=\"$page->prev\"></td>\n ");
print("<td><input type=text name=next size=12 maxlength=30 ");
print("value=\"$page->next\"></td>\n ");
print("<td><input type=text name=footer size=12 maxlength=30 ");
print("value=\"$page->footer\"></td></tr>\n");
print("<input type=hidden name=pid value=$pid>\n");
// buttons for updating page properties
print("<tr class=light>\n <td colspan=5 class=\"center\">\n ");
// reset button
print("<a href=\"page_edit.php3?pid=$pid\">");
print("<img src=\"btn.php3?label=Reset\" name=Reset border=0></a>\n ");
// update button
print("<input type=image src=\"btn.php3?label=Update\" ");
print("name=submit border=0>\n ");
// page list button
print("<a href=\"index.php3\"><img src=\"btn.php3?label=Page+List\" ");
print("alt=\"Page List\" border=0></a></td></tr>\n</form>\n");
// free the initial db query
free_result($result);
// query for page items
$query2 = "select * from item where pid=$pid order by ord";
$result = query($connection, $query2);
$count = numrows($result);
print("<!--\n item query = $query2\n-->\n");
print("<tr><th colspan=5>Page Items</th></tr>\n");
if($count) {
$shade = "light";
for($row=0; $row<$count; $row++) {
$item = fetch_object($result, $row);
$ord = $item->ord;
$alt = (($item->alt) ? $item->alt : " &nbsp ");
print("<tr class=$shade>\n ");
print("<td class=center>\n ");
print("<form action=item_edit.php3 method=post>\n ");
print("<input type=hidden name=id value=$item->id>\n ");
print("<input type=hidden name=pid value=$item->pid>\n ");
print("<input type=image src=\"btn.php3?width=40&label=Edit\" ");
print("name=\"Edit Item $ord\" border=0>\n ");
print("<a href=\"item_delete.php3?id=$item->id&pid=$pid\">");
print("<img src=\"btn.php3?width=40&label=Del\" ");
print("alt=\"Delete Item $ord\" border=0></a>\n ");
print("<td>Item $ord - $item->type</td><td colspan=3>$alt</td></tr>");
print("</form>\n");
$shade = (($row & 1) ? "light" : "dark");
}
}
// new item button
$ord++;
print("<tr class=$shade>\n <td colspan=5 class=\"center\">");
print("<a href=\"item_edit.php3?pid=$pid&ord=$ord\">");
print("<img src=\"btn.php3?label=New+Item\" ");
print("alt=\"New Item\" border=0></a></td></tr>\n");
print("</table>\n</div>\n");
// include footer
print("<br clear=all>\n<div class=\"footer\">\n<hr>\n");
require("../footer.php3");
print("</body>\n</html>");
} else {
print("<div class=center>\n<h2>Database Error</h2>\n");
print("<h2>Failed to connect to database: $dbname</h2>\n");
}
?>