<?php 
include 'dheader.php';
$success = "";
$danger = "";
if (isset($_POST['submitf'])) {
 	# code...
 	extract($_POST, EXTR_OVERWRITE);
 		$sql = $db->query("INSERT INTO units (unit) 
 			VALUES ('$fullname')");
 	
 	if($sql){	
 		$success = "<strong>Success!</strong> Unit added successfully."; 
 	}else{
 		$danger = "<strong>Warning!</strong> Something went wrong.";
 	} 
 }
   
?>
	<div class="modal fade hidden-print" id="myModal" tabindex="-1" role="dialog" aria-hidden="true"></div>
	<div class="wrapper ">
		<?php include 'leftbar.php'; ?>
		<!-- left-bar -->
		<?php include 'topbar.php'; ?>
			<!-- top-bar -->
			<div class="main-content">

<div class="row" id="form">
	<div class="spinner" id="grid-loader" style="display:none">
	  <div class="rect1"></div>
	  <div class="rect2"></div>
	  <div class="rect3"></div>
	</div>
	
	<div class="col-md-12">
			
		
			<form action="" id="customer_form" class="form-horizontal" enctype="multipart/form-data" method="post" accept-charset="utf-8" novalidate="novalidate">

			<div class="panel panel-piluku">
				<div class="panel-heading">
		                <h3 class="panel-title">
		                    <i class="ion-edit"></i> 
		                    Add Unit							<small>(Fields in red are required)</small>
		                </h3>
		        </div>

			<div class="panel-body">
					<?php
                    if (isset($_POST['submitf'])) {
                    ?>
                    <div class="alert alert-<?php echo ($success) ? "success" : "danger"; ?>"> 
                            <?php echo ($success) ? $success : $danger; ?>                          
                    </div>
                 <?php } ?>

				<div class="row">
	<div class="col-md-12">


		<div class="form-group">
			<label for="first_name" class="required col-sm-3 col-md-3 col-lg-2 control-label ">Unit Name :</label>			<div class="col-sm-9 col-md-9 col-lg-10">
				<input type="text" name="fullname" value="" autocomplete="Off" class="form-control" id="fullname">
			</div>
		</div>

 
	</div><!-- /col-md-12 -->
</div><!-- /row -->				
							
						<div class="form-actions pull-right">
														
							<input type="submit" name="submitf" value="Submit" id="submitf" class=" submit_button btn btn-primary">
						</div>
					</div>
				</div>
										</form>
			</div>
		</div><!-- /row -->


	

			
<?php include 'dfooter.php'; ?>