-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearchcategories.php
32 lines (29 loc) · 1.02 KB
/
searchcategories.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
require_once ("controllers/searchcategories.php");
if(isset($_POST['query'])){
$search = checkInput($_POST['query']);
$searchResult = new SearchCategory();
$result = $searchResult->categorySearch($search);
$decodeResult = json_decode($result, true);
if(isset($decodeResult) && $decodeResult != null){
foreach($decodeResult as $decoded){
?>
<a href="categoriespage.php?cat=<?php echo $decoded['category_id'] ?>
&title=<?php echo $decoded['title']?> &name=<?php echo $decoded['name'] ?>&id=<?php echo $decoded['id']?> ">
<span class="searchspan">
<?php
$images = explode(',', $decoded['images']);
?>
<img src="<?php echo $images[0] ?>" alt="">
</span> <br>
<span class="searchspan">
<?php
echo $decoded['title'];
?>
</span>
</a>
<?php
}
}else{echo "No result matches your search";}
}
?>