<?php

$getid = $link->hrefquery ();
if ($getid [0] == 'edit') {
	$employee = $db->get_row ( 'employees', array ('e_id' => $getid [1] ) );
	
	$earlier = $db->get_row ( "earlier_award", array ('id' => $getid [1] ) );

} else {
	$employee = $db->get_all ( 'employees' );
}
?>
<?php

if (isset ( $_POST ['submit'] ) && $_POST ['check'] == 'give') {
	$give = $_POST ['give'];
	$award_name = $give ['award_name'];
	$gift_item = $give ['gift_item'];
	$e_id = $give ['e_id'];
	$month = $give ['month'];
	$year = $give ['year'];
	$date = $give ['date'];
	
	$insert = $db->insert ( 'earlier_award', array ('award_name' => $award_name, 'gift_item' => $gift_item, 'e_id' => $e_id, 'month' => $month, 'year' => $year, 'date' => $date ) );
	if ($insert) {
		?>
<div id="hide">
	<div id="gritter-notice-wrapper">
		<div id="gritter-item-1" class="gritter-item-wrapper gritter-success"
			style="">
			<div class="gritter-top"></div>
			<div class="gritter-item">

				<div class="gritter-without-image">
					<span class="gritter-title">Cheers..
						<div class="gritter-close" id="gritterremove"
							style="display: inline;"></div>
					</span>
					<p>Your Record Is Inserted ...</p>
				</div>
				<div style="clear: both"></div>
			</div>
			<div class="gritter-bottom"></div>
		</div>
	</div>
</div>
<?php
	
	} else {
		?>
<div class="hide1">
	<div id="gritter-notice-wrapper">
		<div id="gritter-item-2" class="gritter-item-wrapper gritter-warning"
			style="">
			<div class="gritter-top"></div>
			<div class="gritter-item">
				<div class="gritter-close" id="gritterremove"
					style="display: inline;"></div>
				<h5>Oops! There Is Some Problem In Inserted..</h5>
				<div style="clear: both"></div>
			</div>
			<div class="gritter-bottom"></div>
		</div>
	</div>
</div>
<?php
	
	}
}
?>
<?php

if (isset ( $_POST ['update'] ) && $_POST ['check'] == 'give') {
	$give = $_POST ['give'];
	$award_name = $give ['award_name'];
	$gift_item = $give ['gift_item'];
	$id = $_POST ['id'];
	$e_id = $give ['e_id'];
	$month = $give ['month'];
	$year = $give ['year'];
	$date = $give ['date'];
	
	$insert = $db->update ( 'earlier_award', array ('award_name' => $award_name, 'gift_item' => $gift_item, 'e_id' => $e_id, 'month' => $month, 'year' => $year, 'date' => $date ), array ('id' => $id ) );
	if ($insert) {
		?>
<div id="hide">
	<div id="gritter-notice-wrapper">
		<div id="gritter-item-1" class="gritter-item-wrapper gritter-success"
			style="">
			<div class="gritter-top"></div>
			<div class="gritter-item">

				<div class="gritter-without-image">
					<span class="gritter-title">Cheers..
						<div class="gritter-close" id="gritterremove"
							style="display: inline;"></div>
					</span>
					<p>Your Record Is Updated ...</p>
				</div>
				<div style="clear: both"></div>
			</div>
			<div class="gritter-bottom"></div>
		</div>
	</div>
</div>
<?php
		$earlier = $db->get_row ( "earlier_award", array ('id' => $getid [1] ) );
	} else {
		?>
<div class="hide1">
	<div id="gritter-notice-wrapper">
		<div id="gritter-item-2" class="gritter-item-wrapper gritter-warning"
			style="">
			<div class="gritter-top"></div>
			<div class="gritter-item">
				<div class="gritter-close" id="gritterremove"
					style="display: inline;"></div>
				<h5>Oops! There Is Some Problem In Updated..</h5>
				<div style="clear: both"></div>
			</div>
			<div class="gritter-bottom"></div>
		</div>
	</div>
</div>
<?php
	
	}
}
?>