<?php include('menu.php');

?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>

   
    <link rel="stylesheet" type="text/css" href="css/pstyle.css"/>
  
    
    <link rel="shortcut icon" href="images/fav-icon.png"/>
  </head>
  <body>
      <?php
        if (isset($_SESSION['add'])) {
          echo $_SESSION['add'];
          unset($_SESSION['add']);
        }
        if (isset($_SESSION['userid'])) {
          // code...
          $userid = $_SESSION['userid'];
        }


    if (isset($_POST['submit'])) {
            // code...
         echo $id = $_POST['id'];
           echo $image_name = $_POST['image_name'];
         echo  $title = $_POST['title'];
         echo   $price = $_POST['price'];
            $description = $_POST['description'];
            $featured = $_POST['featured'];
            $active = $_POST['active'];
            $qty = $_POST['qty'];

          
}

       ?>
    
    <!-- navigation -->
    <nav>
      <!--social-link-and-phone-number  -->
      <div class="social-call">
        <!-- social-links -->
        <div class="social">
          <img src="images/facebook-f.svg"width="15px">
          <img src="images/twitter-square.svg"width="15px">
              <img src="images/youtube.svg"width="15px">
                <img src="images/instagram.svg"width="15px">
        </div>

        <!-- phone-number -->
        <div class="phone">
          <span>Call +254 716181020</span>
        </div>
      </div>
      <!-- menu bar -->
      <div class="navigation">
        <!-- .logo -->
        <a href="javascript:void(0);" class="logo">
          <img src="images/logo.png">
        </a>
        <div class="toggle"></div>
        <!-- munu -->
        <ul class="menu">
          <li><a href="javascript:void(0);">Home</a></li>
          <li><a href="javascript:void(0);">Shop</a></li>
          <li><a href="javascript:void(0);">Men</a>
            <!-- label -->
            <label class="sale-label">Sale</label>
          </li>
          <li><a href="javascript:void(0);">Women</a></li>
          <li><a href="javascript:void(0);">Kids</a></li>

        </ul>
         <!-- right-menu -->
         <div class="right-menu">
           <!-- search -->
           <a href="javascript:void(0);">
             <img class="search" src="images/search.svg" width="25px">
           </a>
           <!-- user -->
           <a href="javascript:void(0);">
             <img class="user"src="images/user.svg" width="25px">
           </a>
           <!-- cart-icon-->
           <a href="javascript:void(0);">

              <i class="fas fa-shopping-cart">
                 <img class="fa-shopping-cart"src="images/cart-plus.svg"width="25px">
                 <span class="num-cart-product">0</span>
              </i>
             <!--img class="cart"src="images/cart-plus.svg" width="20px" number of products in a cart -->

           </a>
         </div>

      </div>
    </nav>
    <!-- search bar -->
    <div class="search-bar">
      <!-- search-input -->
      <div class="search-input">
        <!-- input -->
        <input type="text" placeholder="Search For Product"/>
        <!-- cansel btn -->
        <a href="javascript:void(0);" class="search-cansel"> &times;</a>
      </div>
    </div>
    <div><?php echo $price?></div>
    <form action="insert.php" method="post" enctype="multipart/form-data">
      <div class="order-message1">
        <div class="order-message-container2">
          <div class="order-message-image">
          <img src="<?php echo SITEURL; ?>images/products/<?php echo $image_name; ?>" width="100px">
          <?php 
          if ($qty > 0) {
          echo "<span class='in-stock'>In Stock</span>";
          } else {
           echo "<span class='out-of-stock'>Out of Stock</span>";
          }
          
           ?>
          </div>
        
        <div class="order-message-content">
          
          <span >Name: <?php echo $title?></span>
          
          
          
        </div>
        <div class="order-message-content">
          <span class='total'>Price: <?php echo $price?></span>
        </div>
        <div class="order-message-content">
          <span class="qty1">Qty: <input type="number" name="qty" min="1" max="<?php echo $qty ?>"  placeholder="0"></span>
        </div>
        <div class="order-message-content">
          <span class="size">Size:
            <select name="size">
              <option>Small</option>
              <option>Medium</option>
              <option>Large</option>
              <option>Extra Large</option>
            </select>
          </span>
        </div>
        <div class="description">
          <div class="description-details">
            <span >Description: <?php echo $description?></span>
          </div>
          
        </div>
        <div class="">
          <input class="btns" type="submit" name="add-cart1" value="Add-cart 🛒🛒"  <?php echo ($qty > 0) ? 'enabled' : 'disabled'; ?>>
          <input type="hidden" name="prodid" value="<?php echo $id?>">
            <input type="hidden" name="userid" value="<?php echo $userid ?>">
            
           
        </div>
        </div>
        
        
      </div>
    </form>
    