<?php
   require_once("header.php");
   require_once("menu.php");
   
   $_SESSION['error'] = '';
  
   /** Edit Supply Chain ***/
		if(isset($_POST['update'])){
			$why_visibility['360_id'] = $_POST["360_id"];
			$why_visibility['360_title'] = $_POST["360_title"];
			$why_visibility['360_content'] = $_POST["360_content"];
			$why_visibility['360_icon'] = $_POST["360_icon"];
			$ex = $obj->update_why_visibility($why_visibility);
			echo '<script>window.location="why_us.php"</script>';
		}
    /** End Edit Supply Chain **/
	
	/*** View data id wise**/
			if(isset($_REQUEST['edit']))
			  {
			    $why_visibility_id = base64_decode($_REQUEST['edit']);
				$ex = $obj->view_whyus_visibility_id($why_visibility_id);
				$row = mysqli_fetch_array($ex);
			  }
     /***end data id wise***/
   ?>  
<div id="layoutSidenav_content">
<main class="mt-4">
   <div class="container-fluid">
      <div class="card mb-4">
         <div class="card-header">
            <i class="fas fa-check-square mr-1"></i>Why Us 360 Visibility Section
            <a href="why_us.php" class="btn btn-primary btn-sm float-right">Back</a>
         </div>
         <div class="card-body">
            <p class="text-danger"><?php echo $_SESSION['error'];?></p>
            <form method="post">
               <input type="hidden" name="360_id" value="<?php echo $why_visibility_id;?>">
			   
               <div class="form-group">
                  <label>Title</label>
				  <input type="text" name="360_title" class="form-control" value="<?php echo $row['360_title'];?>">
               </div>
			   
			    <div class="form-group">
                  <label>Content</label>
				  <input type="text" name="360_content" class="form-control" value="<?php echo $row['360_content'];?>">
               </div>
			   
               <div class="form-group">
                  <label>Icon Text</label>
                 <input type="text" name="360_icon" class="form-control" value="<?php echo $row['360_icon'];?>">
                  </div>
               
               
               <?php if(isset($_REQUEST['edit']))
                  { ?> 
               <button type="submit" class="btn btn-primary" name="update">Update</button>
               <?php } 
                  else
                  { ?>
               <button type="submit" class="btn btn-primary" name="submit">Submit</button>
               <?php } ?>
            </form>
         </div>
      </div>
   </div>
</main>
<script>
    var url = "why_us.php";
</script>
<?php require_once("footer.php");?>