<?php 
if ($_GET['id']) {
    $sub_rentorhire->display_category_by_id($_GET['id']);
} else {
    $sub_rentorhire->display_category();
}
?>

<div id="subcategory" style="display:block;">
<?php 
if ($_GET['id']) {
    ?>

<?php 
    require_once $_SERVER['DOCUMENT_ROOT'] . "/common/class/sub_rentorhire.class.php";
    $sub_rentorhire = new sub_rentorhire();
    $result = $sub_rentorhire->get_all_sub_category($_GET['id']);
    ?>

<form name="listjob" action="delete_subcategory.php?action=delete&cate_id=<?php 
    echo $_GET['id'];
    ?>
" method="post" onsubmit="return deletesubcategory(); ">
<input type="hidden" id="type" name="type" value="" />
<input type="hidden" id="selectcheck"  name="selectcheck" />
<table width="100%"><tr><td align="right" width="100%">
<?php 
    if (is_array($result)) {
        ?>
<b><font color="red" size="2"> *Delete : this will delete there all data from the website </font></b><input type="submit" value="Delete" /></td></tr></table>
<table width="100%" style="font-family:Arial, Helvetica, sans-serif; font-size:13px;"> 	
<?php

include "header.php";
require_once "../common/class/sub_rentorhire.class.php";
$delete_category = new sub_rentorhire();
if ($_GET['action'] == "delete" && $_GET['id'] == "") {
    $midarray = explode(",", $_POST['selectcheck']);
    foreach ($midarray as $w) {
        $delete_category->delete_sub_category($w);
    }
    //disconnect_db($cn);
    echo "<script>alert('Sub Category Deleted ...'); window.location='rentorhire_sub_category.php?id=" . $_GET['cate_id'] . "';</script>";
} else {
    $delete_category->delete_sub_category($_GET['id']);
    echo "<script>alert('Sub Category Deleted ...'); window.location='rentorhire_sub_category.php?id=" . $_GET['cate_id'] . "';</script>";
}
?>

<?php

include "header.php";
require_once "../common/class/sub_rentorhire.class.php";
$sub_rentorhire = new sub_rentorhire();
?>

<table align="center" width="100%">
<tr align="center">
<td align="center" bgcolor="#66CCFF">Add Rent or Hire Sub Category</td>
</tr>
</table>
<form name="frmaddcategory" action="rentorhire_sub_category.php?wtdo=add_category&id=<?php 
echo $_GET['id'];
?>
" method="post" onSubmit="if(validateForm(this)) return true; else return false;">
<table align="center">
		<tr>
				<td><label for="tags"><strong>Category Name</strong></label></td>
				<td><?php 
echo $sub_rentorhire->get_name_category_id($_GET['id']);
?>
                <span class="checkStatus"></span>           	
          		</td>
		</tr>

		<tr>
				<td><label for="tags"><strong>Sub Category Name</strong></label></td>
				<td><input type="text" id="subcategory" name="subcategory" class="vldnoblank textWidth" />
                <span class="checkStatus"></span>            	
         		 </td>
<?php

include "header.php";
require_once "../common/class/mysql.class.php";
require_once "../common/class/rentorhire.class.php";
require_once "../common/class/category.class.php";
require_once "../common/class/sub_rentorhire.class.php";
require_once "../common/class/user.class.php";
$category = new subcategory("sub_maincategory");
$sub_rentorhire = new sub_rentorhire();
?>
 
<style>
.grey
{
font-weight:bold;
color:#FFFFFF;
}
</style><script src="/js/checkall.js"></script>
<script language="javascript">

var checkBoxArr;

function deleterentorhire()
{
	checkBoxArr = getSelectedCheckboxValue(document.listjob.checkdel);
	if (checkBoxArr.length == 0) 
 	{ 
	 alert("No Users Selected");  
	 return false;
	 }