<?php
   require_once("header.php");
   require_once("menu.php");
   
   $_SESSION['error'] = '';
  
    /** Add a Ethics Glance ***/
		  if(isset($_POST['submit']))
				{
					  $glance['ethics_glance_number'] = $_POST["ethics_glance_number"];
					  $glance['ethics_glance_text'] = $_POST["ethics_glance_text"];
					  $glance['ethics_glance_icon'] = $_POST["ethics_glance_icon"];
					  
					   $ex = $obj->add_ethics_glance($glance);
					   echo '<script>window.location="glance.php"</script>';
				}
    /** End Ethics Glance Add Code**/




   	/** Edit Ethics Glance ***/
		if(isset($_POST['update'])){
			          $glance['ethics_glance_id'] = $_POST["ethics_glance_id"];
					  $glance['ethics_glance_number'] = $_POST["ethics_glance_number"];
					  $glance['ethics_glance_text'] = $_POST["ethics_glance_text"];
					  $glance['ethics_glance_icon'] = $_POST["ethics_glance_icon"];
			
			$ex = $obj->edit_ethics_glance_home($glance);
			echo '<script>window.location="glance.php"</script>';
		}
    /** End Edit Ethics Glance **/
	
	/*** View data id wise**/
			if(isset($_REQUEST['edit']))
			  {
			    $ethics_glance_id = base64_decode($_REQUEST['edit']);
				$ex = $obj->view_ethics_glance_by_id($ethics_glance_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>Home Page Ethics Glance Section
            <a href="glance.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="ethics_glance_id" value="<?php echo $ethics_glance_id;?>">
			   
               <div class="form-group">
                  <label>Numbers</label>
				  <input type="text" name="ethics_glance_number" class="form-control" value="<?php echo $row['ethics_glance_number'];?>">
               </div>
			   
			   <div class="form-group">
                  <label>Title</label>
				  <input type="text" name="ethics_glance_text" class="form-control" value="<?php echo $row['ethics_glance_text'];?>">
               </div>
			   
               <div class="form-group">
                  <label>Icon Text</label>
                 <input type="text" name="ethics_glance_icon" class="form-control" value="<?php echo $row['ethics_glance_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 = "glance.php";
</script>
<?php require_once("footer.php");?>