I have this page setup where I can highlight the selected values with checkbox on the table. And this code works fine. https://jsfiddle.net/zt54jqtL/
When I try to replace the static form1 code with the following php generated code, it doesn't highlight the selected cells. How can I fix this problem? please. Thank you!
The php code that I implement is this:
<?php
include 'etc/config.php';
mysqli_select_db($conn, $dbname);
$subjectName = 'SELECT * FROM tablea order by Week DESC';
$subject = mysqli_query($conn, $subjectName);
?>
<div>
<form method="post" action=" ">
<?php
while ($data = mysqli_fetch_array($subject)) {
echo "<div>";
echo "<input type='checkbox' class='selector' value='{$data['Value1']}'>" . $data['Value1'];
echo "<input type='checkbox' class='selector' value='{$data['Value2']}'>" . $data['Value2'];
echo "<input type='checkbox' class='selector' value='{$data['Value3']}'>" . $data['Value3'];
echo "<input type='checkbox' class='SelectAll'>All";
echo "</div>";
}
?>
</form>
<script>
$(".SelectAll").click(function () {
$(this).parent().find('input:checkbox').not(this).prop('checked', this.checked);
});
</script>