<?php
session_start();

include "../conn.php";
include "../functions.php";

checkAdmin(session_id());

$title = "Category Listing";
include "header.php";

$query = "select * from jobcat order by catname asc";
$result = mysql_query($query) or die (mysql_error());

?>

<center>
<table border=0 width=80% cellpadding=5 cellspacing=1>
<tr bgcolor="#a0a0a0"><th>Category Name</th><th>Category Description</th><th colspan=2>Options</th></tr>

<?php

$lastColor = 1;

while ($row = mysql_fetch_array($result))
{
	$jobcatid = $row[0];
	$catname = $row[1];
	$catdescrip = $row[2];
	
	$lastColor = ($lastColor + 1) % 2;
	
	altBG($lastColor);
	echo "<td>$catname</td>";
	echo "<td>$catdescrip</td>";
	echo "<td align=\"right\"><form action=\"modcat.php\" method=\"post\"><input type=\"hidden\" name=\"jobcatid\" value=\"$jobcatid\"><input type=\"submit\" value=\"Modify\"></td></form>";
	echo "<td align=\"left\"><form action=\"delcat.php\" method=\"post\"><input type=\"hidden\" name=\"jobcatid\" value=\"$jobcatid\"><input type=\"submit\" value=\"Delete\"></td></form>";
}
?>
</table>
</center>

<?php
include "footer.php";
?>