I have a problem. I am created checkbox with font-awesome heart shape icon for saving favorite item in a loop. But only 1st checkbox works and others checkbox not worked. When I click the second or other loop checkbox, its checked 1st loop check box, second loop and other loop checkbox not working. Why this happened? Thanks!
HTML:
$query = $db->query("SELECT * FROM theme_upload WHERE approve_status != '0' ORDER BY id DESC LIMIT $limit ");
if($query->num_rows > 0){ ?>
while($row = $query->fetch_assoc()){
$postID = $row['id'];
//var_dump($row);
?>
<!-- Template #1 -->
<div class="col-sm-6 col-md-4">
<div class="single-template">
<h3>
<a href="http://hibootstrap.com/onepage/martian/" class="theme-link" target="_blank">
<?php echo $row["theme_name"]; ?>
</a>
</h3>
<div class="fav">
<input id="box1" type="checkbox" />
<label for="box1">Checkbox 1</label>
</div>
</div>
</div>
</div>
</div>
<!-- /.Template #1 -->
<?php } ?>
<?php echo $pagination->createLinks(); ?>
<?php } ?>
CSS:
.fav input[type=checkbox] { display:none; }
.fav input[type=checkbox] + label:before {
font-family: FontAwesome;
display: inline-block;
}
.fav input[type=checkbox] + label:before { content: "\f08a"; }
.fav input[type=checkbox] + label:before { letter-spacing: 10px; }
.fav input[type=checkbox]:checked + label:before { content: "\f004"; }
.fav input[type=checkbox]:checked + label:before { letter-spacing: 10px; }