The idea is to have list of checkbox for user to select genre type. The genre input is from database. Because the sql will return the result in an array, a for loop to get all the values and make them into a check box. The error come from third line in the loop. It show undefined index genre
<div class="list-group">
      <h3>Genre</h3>
      <?php
      $search_genre = "SELECT DISTINCT(genre) FROM movie_db WHERE product_status ='1' ORDER BY movieid DESC"
      $statement = mysqli_query($conn,$search_genre);
      $result = mysqli_fetch_all($statement);
      foreach ($result as $row){
         ?>
         <div class="list-group-item checkbox">
         <label><input type="checkbox" class="common_selector genre" value="<?php echo$row['genre'];?> > <?php echo $row['genre'];?></label>
</div>
<?php
}
?>
 
    