<?php
$unique_key = $_REQUEST['u']; 
session_start();
 date_default_timezone_set('Asia/Kolkata');
if(!isset($_SESSION[$unique_key]) || $_SESSION[$unique_key] !== true){
     header("location: ../Session_A.php");
    exit;
}

$fullname=htmlspecialchars($_SESSION["fullname"]);   

$user_image="headicon.jpg"; 

$user_id=htmlspecialchars($_SESSION["user_id"]);
$date_of_entry=date('d-m-Y');
?>

<?php
include('include/header.php');


?>
<body class="vertical dark" oncontextmenu="return false" onselectstart="return false" ondragstart="return false">
  <div class="wrapper">

    <?php
    include('include/sidebar.php')
    ?>
  
      <main role="main" class="main-content">
        <div class="container-fluid">
          <div class="row justify-content-center">
            <div class="col-12">
			<h2 class="h5 page-title">Welcome! <?php echo $fullname; ?></h2>
             
              <div class="card shadow mb-4">
                <div class="card-header">
                  <strong class="card-title">Update</strong>
                </div>
                <div class="card-body">
				  <?php
					 
							 $id= $_REQUEST["key"];
							require_once "DBConfig.php";
							$result = mysqli_query($link,"SELECT * FROM cust_enq_table WHERE enq_id='".$id."'");
							if(mysqli_num_rows($result)>0) {
							
							while($row = mysqli_fetch_array($result)) {
					?>
				 <form method="POST" class="needs-validation" action="Contact_Status_API_U.php">
                  <div class="row">
                    <div class="col-md-6">
                      <div class="form-group mb-3">
                        <label for="simpleinput">Name</label>
                        <input type="text" name="name" class="form-control"  value="<?php echo $row["name"]; ?>" readonly>
						<input type="hidden" name="enq_id" class="form-control"  value="<?php echo $row["enq_id"]; ?>">
						<input type="hidden" name="u" class="form-control"  value="<?php echo $unique_key; ?>">
                      </div>
                     
                     <div class="form-group mb-3">
                        <label for="simpleinput">Mobile Number</label>
                        <input type="text" name="mobile" class="form-control"  value="<?php echo $row["mobile"]; ?>">
						
                      </div>
                      <div class="form-group mb-3">
                        <label for="simpleinput">Date</label>
                        <input type="text" name="date_of_entry" class="form-control"  value="<?php echo $row["date_of_entry"]; ?>">
						
                      </div>   
                    </div> <!-- /.col -->
                    <div class="col-md-6">
                         <div class="form-group mb-3">
                        <label for="simpleinput">Email</label>
                        <input type="text" name="email" class="form-control"  value="<?php echo $row["email_id"]; ?>">
						
                      </div>                
                  
                         
					  
					    <div class="form-group mb-3">
                        <label for="simpleinput">Message</label>
                       
						<textarea name="message" class="form-control" rows="5"><?php echo $row["message"]; ?></textarea>
						
                      </div> 
					  
					     <div class="form-group mb-3">
                        <label for="simpleinput">Status</label>
					
						<select name="status" class="form-control">
							<option value="<?php echo $row["status"]; ?>"><?php echo $row["status"]; ?></option>
  <option value="New">New</option>
  <option value="Wait">Wait</option>
  <option value="Done">Done</option>
  <option value="Error">Error</option>
  <option value="Others">Others</option>
</select>
                       
						
                      </div>         
                    </div>
					<div class="col-md-6">
                      <div class="form-group mb-3">
                        <button type="submit" class="btn mb-2 btn-info">Update</button>
                      </div>
                    
                     <div class="form-group mb-3">
                      
                      </div>
                    </div>
                  </div>
             
				</form>
				<?php
						}
				}
				?>
				   </div>
              </div> <!-- / .card -->
             
			   
        </div> <!-- .container-fluid -->
       
            </div>
          </div>
        </div>
      </main> <!-- main -->
    </div> <!-- .wrapper -->
   <?php 
  include('include/footer.php');
 
include('include/Script.php')
?>
  </body>
</html>