I am trying to sort images with a title that I have previously uploaded. However, I always get all the images in the database. Can someone help me with this. I am still a beginner in PHP
<div class="container-gallery">
<form class="form-horizontal" action="gallery.php" method="post">
<label>Filter:</label>
<input type="radio" name="video" value="Video" class="form-control">Videos
<input type="radio" name="bücher" value="Bücher" class="form-control">Bücher
<input type="radio" name="bilder" value="Bilder" class="form-control">Bilder
<input type="submit" name="submit" value="Senden" class="form-control"></input>
.
</form>
<?php
if(isset($_POST['submit'])){
$video = $_POST['video'];
$book = $_POST['bücher'];
$pic = $_POST['bilder'];
// Get images from the database
$query = $conn->query("SELECT * FROM images WHERE title Like '%$video%' OR '%$book%' OR '%$pic%'");
if ($query->num_rows > 0) {
while ($row = $query->fetch_assoc()) {
$imageURL = 'upload/' . $row['file_name'];
?>
<img src="<?php echo $imageURL; ?>" alt="" width="300px" height="300px" />
<?php
}
}
else{
?>
<p>Data not Found</p>
<?php
}
}
?>
</div>