<?php include('files/header.php'); ?>
<div id="content-outer">
<div id="content">
<div id="page-heading">
<h1><?php echo $lang_admin['categories']; ?></h1>
</div>
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
<th rowspan="3" class="sized"><img src="files/shared/side_shadowleft.jpg" width="20" height="300" alt="shadow_l"></th>
<th class="topleft"></th>
<td id="tbl-border-top"> </td>
<th class="topright"></th>
<th rowspan="3" class="sized"><img src="files/shared/side_shadowright.jpg" width="20" height="300" alt="shadow_r"></th>
</tr>
<tr>
<td id="tbl-border-left"></td>
<td><div id="content-table-inner">
<div id="table-content">
<p><?php
echo '<table width="100%">
<tr><td>';
if($_SERVER['REQUEST_METHOD'] != 'POST') {
echo '<form method="post" action="">
<p><input type="text" class="fields" name="cat_name" size="40" /> <strong>' . $lang_admin['cat_name'] . '</strong></p>
<br><strong>' . $lang_admin['description'] . ':</strong><br>
<textarea name="cat_description" class="fields" cols="50" rows="4" /></textarea><br><br>
<input type="submit" class="button" name"' . $lang_admin['create_category'] . '" value="' . $lang_admin['create_category'] . '">
</form><br />';
}else{
$sql = "INSERT INTO categories(cat_name, cat_description)
VALUES('" . mysql_real_escape_string($_POST['cat_name']) . "',
'" . mysql_real_escape_string($_POST['cat_description']) . "')";
$result = mysql_query($sql);
if(!$result) {
echo '<p>' . $lang_admin['couldnot_category'] . '</p>';
}else{
echo '<p>' . $lang_admin['success_category'] . '</p>';
}
}
echo '</td></tr>';
echo '</table>';
?></p>
<p> </p>
<p> </p>
<p><strong><u><?php echo $lang_admin['cat_remove']; ?></u></strong></p>
<p> </p>
<p><?php
$query = "SELECT cat_id, cat_name, cat_description FROM categories";
$result = mysql_query($query);
if($result) {
echo '<table width="100%" class="maintable">
<tr>
<td width="5%"><strong>ID</strong></td>
<td width="25%"><strong>' . $lang_admin['cat_name'] . '</strong></td>
<td width="60%"><strong>' . $lang_admin['description'] . '</strong></td>
<td width="10%"><span class="false">' . $lang_admin['delete'] . '</span></td>
</tr>
</table>';
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<table width="100%" class="maintable">
<tr>
<td width="5%"><strong>' . htmlentities($row['cat_id']) . '</strong></td>
<td width="25%">' . htmlentities($row['cat_name']) . '</td>
<td width="60%">' . htmlentities($row['cat_description']) . '</td>
<td width="10%"><a href="categories_delete.php?cat_id=' . $row['cat_id'] . '"><img src="files/delete.png" width="16" height="16" border="0" title="' . $lang_admin['delete'] . '"></a></td>
</tr>
</table>';
}
}else{
echo '<p>' . $lang_admin['no_records'] . '.</p>';
}
?></p>
</div>
</div></td>
<td id="tbl-border-right"></td>
</tr>
<tr>
<th class="sized bottomleft"></th>
<td id="tbl-border-bottom"> </td>
<th class="sized bottomright"></th>
</tr>
</table>
<div class="clear"></div>
</div>
<div class="clear"> </div>
</div>
<div class="clear"> </div>
</div>
<?php include('files/footer.php'); ?>