<?php
if (isset ( $_POST ['submit'] ) && $_POST ['checkedit'] == 'edit') {
	$_POST ['id'];
	
	$editvalue = $_POST ['edit'];
	
	$name = $editvalue ['name'];
	
	$email = $_POST ['hidden_email'];
	
	$contact = $editvalue ['contact'];
	
	$paymentdetails = $editvalue ['paymentdetails'];
	$newpayments = $editvalue ['newpayments'];
	$mostawarded = $editvalue ['mostawarded'];
	$earlierawards = $editvalue ['earlierawards'];
	$giveanawards = $editvalue ['giveanawards'];
	$employeesdetails = $editvalue ['employeesdetails'];
	$newemployees = $editvalue ['newemployees'];
	$clientdetails = $editvalue ['clientdetails'];
	$newclient = $editvalue ['newclient'];
	$departments = $editvalue ['departments'];
	$newdepartments = $editvalue ['newdepartments'];
	
	$address = $editvalue ['address'];
	if ($editvalue ['suspen_id'] == 'on') {
		$suspen_id = '0';
	} else {
		$suspen_id = '1';
	}
	
	$pass = $db->get_col ( 'users', array (id => $_POST ['id'] ), 'password' );
	
	$pass1 = $pass [0];
	$editvalue ['password'];
	
	if ($editvalue ['password'] == '') {
		$query = $db->update ( 'users', array ('name' => $name, 'email' => $email, 'contact' => $contact, 'address' => $address, 'suspen_id' => $suspen_id, 'privilege' => $paymentdetails . ',' . $newpayments . ',' . $mostawarded . ',' . $earlierawards . ',' . $giveanawards . ',' . $employeesdetails . ',' . $newemployees . ',' . $clientdetails . ',' . $newclient . ',' . $departments . ',' . $newdepartments ), array ('id' => $_POST ['id'] ) );
		
		if ($query) {
			?>

<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 Are Some Problem In Updated...</h5>
				<div style="clear: both"></div>
			</div>
			<div class="gritter-bottom"></div>
		</div>
	</div>
</div>
<?php
		
		}
	} else {
		$encrypt_pass = $password->stringbreak ( $editvalue ['password'] );
		
		$query1 = $db->update ( 'users', array ('name' => $name, 'email' => $email, 'contact' => $contact, 'address' => $address, 'suspen_id' => $suspen_id, 'privilege' => $paymentdetails . ',' . $newpayments . ',' . $mostawarded . ',' . $earlierawards . ',' . $giveanawards . ',' . $employeesdetails . ',' . $newemployees . ',' . $clientdetails . ',' . $newclient . ',' . $departments . ',' . $newdepartments ), array ('id' => $_POST ['id'] ) );
		if ($query1) {
			?>
<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 Are Some Problem In Updated...</h5>
				<div style="clear: both"></div>
			</div>
			<div class="gritter-bottom"></div>
		</div>
	</div>
</div>
<?php
		
		}
	}
}

?>