I have five (sometimes 7,8 etc.) php generated small HTML tables on the same page, each having a different <table id="">. and I have data on mysql table with unique IDs which is the same as the html table ids.
What I need is each html table matching values to be highlighted with the values of the mysql table row with the same table id.
So instead of using a checkbox with multiple selector values, I need it to be done automatically without clicking any checkbox. Normally with checkboxes, I use something like this: https://jsfiddle.net/zt54jqtL/ Thanks!!
<div>
<form id="form1" name="form1" method="post" action="">
<label>
<input type="checkbox" name="SelectAll" class="all" />All</label>
<label>
<input type="checkbox" name="2" class="selector" />2</label>
<label>
<input type="checkbox" name="7" class="selector" />7</label>
<label>
<input type="checkbox" name="7" class="selector" />7</label>
</form>
PHP code:
<?php
$conn=mysqli_connect("localhost","root","","Mdata");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
function print_tableX ($conn, $id) {
$sql = "SELECT Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8 FROM tableA";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table id='$id'>";
while($row = $result->fetch_assoc()) {
echo '<tr><td>' . join('</td><td>', $row) . "</td></tr>\n" ;
}
echo "</table>";
}
}
$result = $conn->query("SELECT sID from tableB");
while ($row = $result->fetch_assoc()) {
print_tableX ($conn, $row['sID']);
}
?>