<?php include("header.php"); ?>
<?php
$client_id = $_POST['id'];
?>

<?php $clients = mysql_query("SELECT * FROM clients where client_id = '$client_id'") or die(mysql_error());  ?>

			<?php $client = mysql_fetch_array($clients);
				$id = $client['client_id'];
				$first_name = $client['first_name'];
				$middle_initial = $client['middle_initial'];
				$gender = $client['gender'];
				$last_name = $client['last_name'];
				$street = $client['street'];
				$company = $client['company'];
				$city = $client['city'];
				$province = $client['province'];
				$contact = $client['contact'];
				$guards = $client['guards'];
			?>

<script type="text/javascript"> //append append
$(document).ready( function () {

	<!-- local time -->
	var myDate = new Date();
	var pc_date = (myDate.getMonth()+1) + '/' + (myDate.getDate()) + '/' + myDate.getFullYear();
	var pc_time = myDate.getHours()+':'+myDate.getMinutes()+':'+myDate.getSeconds();
	jQuery(".pc_date").val(pc_date);
	jQuery(".pc_time").val(pc_time);
	<!-- local time-->
	
$("#append").click( function() {
		$(".inc").append('<div class="field"><label>&nbsp;</label><select class="guards" name="guards[]"><?php guards(); ?></select><a href="#" class="remove_this">remove</a></div>');
		return false;
	});
	
// using live() will bind the event to all future
// elements as well as the existing ones
$('.remove_this').live('click', function() {
    $(this).parent().remove();
    return false;
});
	
jQuery('#update-client').submit(function(e){
    e.preventDefault();
    var formData = jQuery(this).serialize();
    jQuery.ajax({
        type: 'POST',
        url:  'update_client.php',
        data: formData,
        success: function(msg){
            showNotification({
message: "Client's Profile Successfully Updated",
type: "success", // type of notification is error/success/warning/information,
autoClose: true, // auto close to true
duration: 5 // message display duration
});
<!--redirection -->
		 var delay = 3000;
		setTimeout(function(){ window.location = 'view_client_list.php';}, delay);  
<!--redirection end -->	
        }
    });
});
});

</script> 
			
<!--the content-->			

<title>Modify Client</title>
</head>
<body class="add_user standard">
<div class="wrapper">

	<div class="header">
	<h1>Lifeguard Archangels Security Corporation</h1>
	</div>
	<?php include("main_menu.php"); ?>
		<div class="right_nav">
		<h1>Profiles</h1>
	<?php include("right_nav.php"); ?>
	</div>
	<div class="content">
	<div class="title_page">
	</div>
	
	<div class="actions">
	<div class="form label-inline uniform" id="shadow" style="width: 700px; margin:0 auto;" >
	<h2>Modify Client</h2>
	<form id="update-client">
		<!--local time -->	
		<input type="hidden" class="pc_date" name="pc_date" >
		<input type="hidden" class="pc_time" name="pc_time" >
		<!--local time -->
	<input type="hidden" value="<?php echo $_SESSION['user_name']; ?>" name="user">
	<input class="id" value="<?php echo $id; ?>"  name="id" size="30" type="hidden"/>
	<div class="field"><label>Firstname</label> <input class="firstname" value="<?php echo $first_name; ?>" name="firstname" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Middle Initial</label>
		<select name="middle_initial" class="middle_initial" >
		<option><?php echo $middle_initial; ?></option>
		<option>A</option>
		<option>B</option>
		<option>C</option>
		<option>D</option>
		<option>E</option>
		<option>F</option>
		<option>G</option>
		<option>H</option>
		<option>I</option>
		<option>J</option>
		<option>K</option>
		<option>L</option>
		<option>M</option>
		<option>N</option>
		<option>O</option>
		<option>P</option>
		<option>Q</option>
		<option>R</option>
		<option>S</option>
		<option>T</option>
		<option>U</option>
		<option>V</option>
		<option>W</option>
		<option>X</option>
		<option>Y</option>
		<option>Z</option>
		</select></div>
	<div class="field"><label>Lastname</label> <input class="lastname" value="<?php echo $last_name; ?>" name="lastname" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Gender </label>
		<select name="gender" class="gender" >
		<option><?php echo $gender; ?></option>
		<option>Female</option>
		<option>Male</option></select></div>
	<div class="field"><label>Company Name</label> <input class="company" value="<?php echo $company; ?>" name="company" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Street </label> <input class="street" value="<?php echo $street; ?>" name="street" size="30" type="text" class="medium" /></div>
	<div class="field"><label>City</label> <input class="city" value="<?php echo $city; ?>" name="city" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Province</label> <input class="province" value="<?php echo $province; ?>" name="province" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Contact Number</label> <input class="contact" value="<?php echo $contact; ?>" name="contact" size="30" type="text" class="medium" /></div>
	
	
	
	<div class="field"><button id="updateclient" name="SubmitOne">Save Changes</button></div>
	
	</form>
	
	</div>
<?php include("footer.php"); ?>
</div>
</body>
</html>