<?php ob_start(); session_start(); ?>
	<!DOCTYPE html>
	<html>
	<?php include "../layouts/db_connect.php"; ?>
	<?php 
if(isset($_SESSION['code'])) {
	  $code = $_SESSION['code'];
	  $scode = $_SESSION['code'];
	   
		$staff = $_SESSION['name'];
		 $postt = $_SESSION['postt'];
		  $mfin222 = $_SESSION['mfin222'];
	} 
	?>
		<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		
		<!-- Meta, title, CSS, favicons, etc. -->
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="X-UA-Compatible" content="chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
    box-sizing: border-box;
}

input[type=text], select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
}

label {
    padding: 12px 12px 12px 0;
    display: inline-block;
}

input[type=submit] {
    background-color: #4CAF50;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    float: right;
}

input[type=submit]:hover {
    background-color: #45a049;
}

.container {
    border-radius: 5px;
    background-color: #f2f2f2;
    padding: 20px;
}

.col-25 {
    float: left;
    width: 25%;
    margin-top: 6px;
}

.col-75 {
    float: left;
    width: 75%;
    margin-top: 6px;
}

/* Clear floats after the columns */
.row:after {
    content: "";
    display: table;
    clear: both;
}

/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
    .col-25, .col-75, input[type=submit] {
        width: 100%;
        margin-top: 0;
    }
}

.button {
    background-color: #4CAF50; /* Green */
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 12px;
    margin: 4px 2px;
    cursor: pointer;
}

.button2 {background-color: #008CBA;} /* Blue */
.button3 {background-color: #f44336;} /* Red */ 
.button4 {background-color: #e7e7e7; color: black;} /* Gray */ 
.button5 {background-color: #555555;} /* Black */

</style>
		<title>INFOSSEL SOFT SOLUTIONS </title> </head>
		<body>
 
    <!--  page-wrapper -->
         <div class="right_col" role="main">

            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
 
  <script>
if(!navigator.geolocation){
	alert('Your Browser does not support HTML5 Geo Location. Please Use Newer Version Browsers');
}
navigator.geolocation.getCurrentPosition(success, error);
function success(position){
	var latitude  = position.coords.latitude;	
	var longitude = position.coords.longitude;	
	var accuracy  = position.coords.accuracy;
	document.getElementById("lat").value  = latitude;
	document.getElementById("lng").value  = longitude;
	document.getElementById("acc").value  = accuracy;
}
function error(err){
	alert('ERROR(' + err.code + '): ' + err.message);
}
</script>
          
                    <h1 class="page-header">Save Customer Location</h1>
                </div>
                <!--end page header -->
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                             Details
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <?php $hpl=$_REQUEST['hpl']; 
                                $mfin=$_REQUEST['mfin']; ?>
   <form name="form1" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
     <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">HPL</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" autofocus="hpl"  name="hpl" value="<?php echo $hpl; ?>" placeholder="" >
    </div>
  </div>
   <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Mfin</label>
    <div class="col-sm-4">
      <input type="text" class="form-control"  name="mfin" value="<?php echo $mfin; ?>" placeholder="" >
	
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Latitude</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="lat"   name="lat" value="" placeholder="" >
    </div>
  </div>
   <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Longitude</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="lng"   name="lng" value="" placeholder="" >
    </div>
  </div>
   <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">More or Less(meters)</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="acc"  name="acc" value="" placeholder="" >
    </div>
  </div>
  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-default" name="s1">Save This</button>
    </div>
  </div>
      <div class="alert alert-success">
	 <?php 						if(isset($_POST['s1']))
							{
								extract($_POST);
								$update=mysqli_query($conn, "update customerdetails set lat='$lat',lang='$lng',lacc='$acc' where mfin='$mfin' && hpl='$hpl' ");
									$update2=mysqli_query($conn, "update pending set lat='$lat',lang='$lng' where mfin='$mfin' && hpl='$hpl' ");
								if($update)
								{
						echo "<script>alert('Register successfully');window.location.href='index2.php'</script><br>";	
									
								}
								else
								{
									echo "Failure";
								}
							}
?>
	  </div>
</form>
</div>
    
                <!-- Main content -->
                <section class="content">
                    <div class="row">
                        <div class="col-xs-12"> 
                            <div class="box">
                               <!-- /.box-header -->
                                <div class="box-body table-responsive">
                                   	
                                </div><!-- /.box-body -->
                            </div><!-- /.box -->
 
</div>
</div></div>
</div></div></div>  </body></html>