<?php
session_start();
include ('../config.php');
include ('secureadmin.php');
$metatitle = "Edit Page - Admin Control Panel";
include ('includes/document_head.php');
$pageid = $_GET['id'];
if($pageid == "new") {
?>
<div id="wrapper">
<?php include 'includes/topbar.php'?>
<?php include 'includes/sidebar.php'?>
<div class="main_container container_16 clearfix">
<div class="flat_area grid_16">
<h2>Page Management - New Page</h2>
<p>Use this area to create a new front-end page. </p>
<br/>
<div class="box grid_16 round_all">
<h2>Create a New Page</h2>
<form style="padding-left: 15px;" name="submission" method="POST" action="pages.php">
<b>Page Title:</b><br/>
<input type="text" name="title" style="width: 250px;">
<br/><br/><p><b>Page Content:</b></p>
<textarea id="body" name="body" style="width:600px; height: 250px;"></textarea>
<div style="clear:both"></div>
<br/>
<input type="checkbox" name="onmenu" checked> Display on Top Menu?<br>
<br/>
<input name="add" type="hidden" id="add" />
<button type="submit" id="submitstyle" name="save" class="button_colour round_all"><img height="24" width="24" alt="Bended Arrow Right" src="images/icons/small/white/Bended Arrow Right.png"><span>Add Page</span></button>
</form>
</div>
<?
// SWITCHING BETWEEN NEW VS EDIT
} else {
$query = "select * from pages where id = ".$pageid.";";
$result = mysql_query($query,$connection) or die(mysql_error());
$info = mysql_fetch_assoc($result);
// get this category's information
$pagetitle = $info['title'];
$pagebody = $info['body'];
$onmenu = $info['onmenu'];
if ($onmenu == 0) {
$onmenu = "checked";
} else {
$onmenu = "";
}
?>
<div id="wrapper">
<?php include 'includes/topbar.php'?>
<?php include 'includes/sidebar.php'?>
<div class="main_container container_16 clearfix">
<div class="flat_area grid_16">
<h2>Page Management - <?php echo $pagetitle; ?></h2>
<p>Use this area to edit the page listed above. </p>
<br/>
<div class="box grid_16 round_all">
<h2>Edit Page</h2>
<form style="padding-left: 15px;" name="submission" method="POST" action="pages.php">
<b>Page Title:</b><br/>
<input type="text" name="title" style="width: 250px;" value="<?php echo $pagetitle; ?>">
<br/><br/><b>Page Content:</b>
</h3><textarea id="body" name="body" style="width:600px; height: 250px;"> <?php echo $pagebody; ?> </textarea>
<div style="clear:both"></div>
<br/>
<input type="checkbox" name="onmenu" <?php echo $onmenu; ?>> Display on Top Menu?<br>
<br/>
<input name="update" type="hidden" id="update" />
<input name="pageid" type="hidden" value="<?php echo $pageid; ?>" />
<button type="submit" id="submitstyle" name="save" class="button_colour round_all"><img height="24" width="24" alt="Bended Arrow Right" src="images/icons/small/white/Bended Arrow Right.png"><span>Update Page</span></button>
</form>
</div>
</div>
<?
} // closing the new vs edit cat else statement
?>
</div>
</div>
</div>
<?php include 'includes/closing_items.php'?>