<?php
   require_once("header.php");
   require_once("menu.php");
   
   $_SESSION['error'] = '';
  
   /** Edit Supply Chain ***/
		if(isset($_POST['update'])){
			$why_digital_promo['digital_promo_id'] = $_POST["digital_promo_id"];
			$why_digital_promo['digital_promo_title'] = $_POST["digital_promo_title"];
			$why_digital_promo['digital_promo_content'] = $_POST["digital_promo_content"];
			$why_digital_promo['digital_promo_icon'] = $_POST["digital_promo_icon"];
			$ex = $obj->update_why_digital_promo($why_digital_promo);
			echo '<script>window.location="why_us.php"</script>';
		}
    /** End Edit Supply Chain **/
	
	/*** View data id wise**/
			if(isset($_REQUEST['edit']))
			  {
			    $digital_promotion_id = base64_decode($_REQUEST['edit']);
				$ex = $obj->view_digital_promo_id($digital_promotion_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 Digital Promostion 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="digital_promo_id" value="<?php echo $digital_promotion_id;?>">
			   
               <div class="form-group">
                  <label>Title</label>
				  <input type="text" name="digital_promo_title" class="form-control" value="<?php echo $row['digital_promo_title'];?>">
               </div>
			   
			    <div class="form-group">
                  <label>Content</label>
				  <input type="text" name="digital_promo_content" class="form-control" value="<?php echo $row['digital_promo_content'];?>">
               </div>
			   
               <div class="form-group">
                  <label>Icon Text</label>
                 <input type="text" name="digital_promo_icon" class="form-control" value="<?php echo $row['digital_promo_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");?>