<?php 
$pgMod = "total_leave";

	 if(isset($_POST['save_details'])){

 	     $allstaff = $_POST[idno];
 	     $i = 0;
	     foreach($allstaff as $idno){

	         $saveAry=array(
                           "cl_count"  =>  $_POST['cl'][$i]
        					);

                $flg  = $db->updateAry("staff",   $saveAry,   "where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$idno."'");
            $i++;
	     }
	     
	      if(!is_null($flg))
 		{
 			$_SESSION['msg']='update Successfully';
 			redirect(URL_ADMIN_HOME.getQueryString(array("src"=>"Payroll", "page_id"=>$pgMod)));
 		}
	     
	 }
?>
  
	<form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Staff List</h3>
                    <div>
						<button type="submit" name="save_details" class="btn btn-primary"> Save Details</button>
					</div>
				</div>
		<div class="well no-padding">
        	<div class="controls controls-row">
		<!--<center><input class="form-control" id="myInput" type="text" placeholder="Search.."></center>-->
		<?php
		$allstaff = $db->getRows("select * from staff where school_id='".$_SESSION["admin"]["school_id"]."' and status=1 order by name ");

		if(is_array($allstaff) && count($allstaff)>0){ ?>
		<table class="table">
		    <thead>
    			<tr>
                    <th>S. No.</th>
                    <th>Name</th>
                    <th>CL</th>
                </tr>
            </thead>
            <tbody id="myTable">
			<?php $i=0;
			foreach($allstaff as $staff){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $staff["name"]; ?></td>
					<td><input type="text" name="cl[]" class="input-block-level" value="<?php echo $staff["cl_count"]; ?>" ></td>
					<input type="hidden" name="idno[]" required  value="<?php echo $staff["idno"] ?>" readonly="readonly" />
                </tr>
				<?php
			}
			?></tbody></table><?php
		}
		?></div></div></div></div></form>