<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./style.css">
</head>
<body>
<!-- input tag -->
<input id="searchbar" onkeyup="search_animal()" type="text"
name="search" placeholder="Search animals..">
<!-- ordered list -->
<?php
$i = 0;
$qry_cat = $conn->query("SELECT * FROM product_list ");
while($row = $qry_cat->fetch_assoc()):
$i++;
?>
<li class="animals"><?php echo $row['product'] ?></li>
<?php endwhile; ?>
<script type="text/javascript">
function search_animal() {
let input = document.getElementById('searchbar').value
input=input.toLowerCase();
let x = document.getElementsByClassName('animals');
for (i = 0; i < x.length; i++) {
if (!x[i].innerHTML.toLowerCase().includes(input)) {
x[i].style.display="none";
}
else {
x[i].style.display="list-item";
}
}
}
</script>
</body>
</html>
عايز اضيف دالة تحفظ لي المنتج الذي تم البحث عنه بمعني اي عملية بحث تكون محفوظة