<?php
include ('include/header.php');
?>
        <!-- BEGIN PAGE LEVEL PLUGINS -->
        <link href="assets/global/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.css" rel="stylesheet" type="text/css" />
        <link href="assets/global/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css" rel="stylesheet" type="text/css" />
        <link href="assets/global/plugins/bootstrap-summernote/summernote.css" rel="stylesheet" type="text/css" />
        <!-- END PAGE LEVEL PLUGINS -->


</head>
<body class="page-header-fixed page-sidebar-closed-hide-logo">


<?php
include ('include/sidebar.php');
?>

 

		
            <!-- BEGIN CONTENT -->
            <div class="page-content-wrapper">
                <!-- BEGIN CONTENT BODY -->
                <div class="page-content">
                    <!-- BEGIN PAGE HEADER-->
                   
                    <!-- BEGIN PAGE TITLE-->
                    <h3 class="page-title"> View Client Details
                        <small></small>
                    </h3>
                    <!-- END PAGE TITLE-->

					<hr>

					
					
					
					
					
			<div class="row">
			<div class="col-md-12">
                            <!-- BEGIN SAMPLE FORM PORTLET-->
                            <div class="portlet light bordered">
                                
                                <div class="portlet-body form">
                                    <form class="form-horizontal" action="" method="post" role="form">
                                        <div class="form-body">

		   
<?php

if(isset($_GET["userID"])){


 $id = $_GET["userID"];


//$err1=0;
//$err2=0;

$exist = mysql_fetch_array(mysql_query("SELECT * FROM user WHERE id='".$id."'"));

$exist = mysql_fetch_array(mysql_query("SELECT * FROM user WHERE id='".$id."'"));

if ($exist[0] == $id){

echo "<div class=\"alert alert-info alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Edit Clients Details Below
</div>";


} else {
	

echo "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>    

 CLIENT ID NOT FOUND !!!

</div>";
}       
    

}

if (isset($_POST['profile'])) {

$f_name = mysqli_real_escape_string($db,$_POST["firstname"]);
$l_name = mysqli_real_escape_string($db, $_POST["lastname"]);
$country = mysqli_real_escape_string($db,$_POST["country"]);
$city = mysqli_real_escape_string($db, $_POST["city"]);
$phone = mysqli_real_escape_string($db,$_POST["phone"]);
$email = mysqli_real_escape_string($db,$_POST["email"]);

$imfcode = mysqli_real_escape_string($db, $_POST["imfcode"]);
$ipncode = mysqli_real_escape_string($db,$_POST["ipncode"]);
$cotcode = mysqli_real_escape_string($db,$_POST["cotcode"]);


$res = mysql_query("UPDATE user SET firstname='".$f_name."', lastname='".$l_name."', phone='".$phone."', email='".$email."', city='".$city."', country='".$country."', imfcode='".$imfcode."', ipncode='".$ipncode."', cotcode='".$cotcode."' WHERE id='".$id."'");

$msg =  "<div class=\"alert alert-success alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>	

Client Profile Successfully Updated

</div>";


}
?>										
<form action="" method="post">	

<centre><? echo $msg ?></centre>
                    <div class="form-group">
                    <label class="col-md-3 control-label"><strong>Account_Number</strong></label>
                    <div class="col-md-6">
                     <input class="form-control input-lg" name="accountnumber" value="<? echo $exist[1] ?>" disabled type="text">
                    </div>
                    </div>
                    <div class="form-group">
                    <label class="col-md-3 control-label"><strong>First_Name</strong></label>
                    <div class="col-md-6">
                     <input class="form-control input-lg" name="firstname" value="<? echo $exist[6] ?>" type="text">
                    </div>
                    </div>
                    <div class="form-group">
                    <label class="col-md-3 control-label"><strong>Last_Name</strong></label>
                    <div class="col-md-6">
                     <input class="form-control input-lg" name="lastname" value="<? echo $exist[7] ?>" type="text">
                    </div>
                    </div>
                    <div class="form-group">
                    <label class="col-md-3 control-label"><strong>Email</strong></label>
                    <div class="col-md-6">
                     <input class="form-control input-lg" name="email" value="<? echo $exist[8] ?>" type="text">
                    </div>
                    </div>
                    <div class="form-group">
                    <label class="col-md-3 control-label"><strong>	Phone</strong></label>
                    <div class="col-md-6">
                     <input class="form-control input-lg" name="phone" value="<? echo $exist[9] ?>" type="text">
                    </div>
                    </div>
                    <div class="form-group">
                    <label class="col-md-3 control-label"><strong>City</strong></label>
                    <div class="col-md-6">
                     <input class="form-control input-lg" name="city" value="<? echo $exist[10] ?>" type="text">
                    </div>
                    </div>
                    <div class="form-group">
                    <label class="col-md-3 control-label"><strong>Country</strong></label>
                    <div class="col-md-6">
                     <input class="form-control input-lg" name="country" value="<? echo $exist[11] ?>" type="text">
                    </div>
                    </div>
                    <div class="form-group">
                    <label class="col-md-3 control-label"><strong>IMF Code</strong></label>
                    <div class="col-md-6">
                     <input class="form-control input-lg" name="imfcode" value="<? echo $exist[3] ?>" type="text">
                    </div>
                    </div>
                    <div class="form-group">
                    <label class="col-md-3 control-label"><strong>IPN Code</strong></label>
                    <div class="col-md-6">
                     <input class="form-control input-lg" name="ipncode" value="<? echo $exist[4] ?>" type="text">
                    </div>
                    </div>
                    <div class="form-group">
                    <label class="col-md-3 control-label"><strong>COT Code</strong></label>
                    <div class="col-md-6">
                     <input class="form-control input-lg" name="cotcode" value="<? echo $exist[5] ?>" type="text">
                    </div>
                    </div>

					 
                                            <div class="row">
                                                <div class="col-md-offset-3 col-md-6">
                                                    <button type="submit" name="profile" class="btn blue btn-block">Submit</button>
                                                </div>
                                            </div>
											
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>		
                        </div><!---ROW-->		
					
</form>					
					
					
					
					
			
					
					
					
					
					
					
                </div>
                <!-- END CONTENT BODY -->
            </div>
            <!-- END CONTENT -->
            
			


<?php
 include ('include/footer.php');
 ?>

        <!-- BEGIN PAGE LEVEL PLUGINS -->
        <script src="assets/global/plugins/bootstrap-wysihtml5/wysihtml5-0.3.0.js" type="text/javascript"></script>
        <script src="assets/global/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.js" type="text/javascript"></script>
        <script src="assets/global/plugins/bootstrap-markdown/lib/markdown.js" type="text/javascript"></script>
        <script src="./assets/global/plugins/bootstrap-markdown/js/bootstrap-markdown.js" type="text/javascript"></script>
        <script src="assets/global/plugins/bootstrap-summernote/summernote.min.js" type="text/javascript"></script>
        <!-- END PAGE LEVEL PLUGINS -->
        <script>
        
    
        
        </script>
        
        <!-- BEGIN PAGE LEVEL SCRIPTS -->
        <script src="assets/pages/scripts/components-editors.min.js" type="text/javascript"></script>
        <!-- END PAGE LEVEL SCRIPTS -->

</body>
</html>