<?php include('../connection.php') ?>

<?php
if (isset($_POST['search_val'])) {

$search_val=$_POST['search_val'];
 
 
$query_search=mysqli_query($link,"SELECT*FROM tbl_certification  where certificationNumber LIKE '%$search_val%' or CompanyName LIKE '%$search_val' or  CompanyName Like '$search_val%' limit 200");
if (mysqli_num_rows($query_search)>0) {
  
while ($arr=mysqli_fetch_assoc($query_search)) {
    ?>
     
     
     
  <tr>
          <td><?= $sn++?></td>
          <td><?= htmlspecialchars($arr['certificationNumber']) ?></td>
          <td><?= htmlspecialchars($arr['companyName']) ?></td>
          <td><?= htmlspecialchars(mb_strimwidth($arr['address'], 0, 60, "...")) ?></td>
          <td><?= htmlspecialchars($arr['scheme']) ?></td>
          <td><?= htmlspecialchars($arr['validTill']) ?></td>
          <td><?= htmlspecialchars($arr['createdOn']) ?></td>
          <td><?= htmlspecialchars($arr['updatedOn']) ?></td>
          <td>
            <a class="btn btn-success" href="add-products.php?edit=<?= $arr['id'] ?>">Edit</a>
            <form method="post" style="display:inline;">
              <input type="hidden" name="id" value="<?= $arr['id'] ?>">
              <input type="submit" name="del" value="Delete" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete this certification?');">
            </form>
          </td>
        </tr>

    <?php

}    
}else {
  echo "<p>Not Found..</p>";
}

}
?>