<?php  ob_start(); session_start();
include("session.php");
include("dbconnection.php");
   $id=$_GET['cid'];
   
   $query=mysql_query("select * from contacts where contact_id='$id' and customer_id='$session_id' ");
   $r = mysql_fetch_array($query);
   $fnme = $r['fname'];
    $lnme= $r['lname'];
						   $pne= $r['contact'];
						   $em= $r['email'];
						   $gr= $r['group_name'];
						   $abt= $r['about'];
						   $adr= $r['address'];
?>
<html>
<head>
	<script src="js/jquery.min.js"></script>
	<link rel="stylesheet" href="popupstyle/jquery_popup.css" />
	<script src="popupstyle/jquery_popup.js"></script>
</head>
	<body id="p">
		<!--Login Form -->
			<div id="logindiv">
				<form class="form" action="#" id="login" method="post" action="">
					<h3> <?php echo $fnme ." ".$lnme ?></h3>
					<hr/><br/>

						<label>First Name : </label> 
							<input type="text" id="fname" name ="fname" required="required" value="<?php echo $fnme ?>" /><br/>
						<label>Last Name : </label> 
							<input type="text" id="lname" name="lname" required="required"  value="<?php echo $lnme ?>"/><br/>
						<label>Contact No: </label>
							 <input type="number" id="cont" name="cont"  value="<?php echo $pne ?>"  /><br/>
						<label>Group : </label>
							 <input type="text" id="group" name="group"  value="<?php echo $gr ?>" /><br/>
						<label>Email : </label>
							 <input type="email" id="email" name="email"  value="<?php echo $em ?>" /><br/>
					    <label>About : </label>
							 <input type="text" id="about" name="about"  value="<?php echo $abt ?>" /><br/>
						<label>Address : </label>
							 <input type="text" id="address" name="address"  value="<?php echo $adr ?>" /><br/> <br/>
							
							<input type="submit" id="loginbtn" value="Update" name="update"/>
							<input type="reset" id="cancel" value="Cancel" /> <br/>

				</form>
					<?php
			if(isset($_POST['update'])){
				$fme= $_POST['fname'];
				        $lme=$_POST['lname'];
						$cnt = $_POST['cont'];
						$grup= $_POST['group'];
						$eml = $_POST['email'];
						$abt=$_POST['about'];
						$add = $_POST['address'];
						
						$sql = mysql_query("update contacts set fname='$fme', lname='$lme', contact='$cnt', group_name='$grup', email='$eml', about='$abt', address='$add' where contact_id='$id' ");
			
			}
			
			
			?>
                  
			</div>
		
</body>
</html>