</ul>
        </div>
        <?php 
$db = connectDb();
$sql2 = "select * from document_actions";
$rs2 = $db->query($sql2);
$nm2 = $rs2->num_rows;
for ($k = 0; $k < $nm2; $k++) {
    $row2 = $rs2->fetch_assoc();
    $action[$k]["id"] = $row2['action_code'];
    $action[$k]["name"] = $row2['action_description'];
}
$db = connectDb();
if (isset($_POST['active_documents'])) {
    $department = getDepartment($db, $_POST['active_documents']);
    $rs = topActiveDocumentsDivision($db, $_POST['active_documents']);
} else {
    $rs = topActiveDocuments($db);
}
$nm = $rs->num_rows;
?>
	
        <div class="wrapper">
        <div class="row">
        <div class="col-sm-12">
        <section class="panel">
        <header class="panel-heading">
            Most Active Documents <?php 
if (isset($_POST['active_documents'])) {
    echo "for " . $department;
}
for ($i = 0; $i < $nm; $i++) {
    $row = $rs->fetch_assoc();
    echo "<option value='" . $row['department_code'] . "'>" . $row['department_name'] . "</option>";
}
echo "</select>";
echo "</td>";
echo "<td><input class='btn btn-success' type=submit value='Get Most Active' /></td>";
echo "</tr>";
echo "</table>";
?>
</form>
<?php 
if (isset($_POST['divisionActive'])) {
    $department = getDepartment($db, $_POST['divisionActive']);
    $db = retrieveRecordsDb();
    $rs = topActiveDocumentsDivision($db, $_POST['divisionActive']);
    $nm = $rs->num_rows;
    if ($nm > 0) {
        ?>

	<table style='font-size:13px;' class='table table-striped table-bordered'  width=100%>
	<thead>
	<tr>
	<th colspan=8><h3>Active Documents for <?php 
        echo $department;
        ?>
</h3></th>
	</tr>
	<tr>
	<th>Office Code</th>
	<th>Document Date</th>