I’d like to create a checkbox that, when checked, displays info from 1 specific MySQL query via PHP, and when unchecked, displays data from a different MySQL query via PHP.
So I have:
<INPUT TYPE=”checkbox” NAME=”maxSpecs” onClick=”???”><br><br>
and 2 working, different MySQL queries (abbreviated here):
$result = mysql_query(“SELECT * FROM laptops ORDER BY Price ASC LIMIT 0, 10;”) or die(mysql_error());
printf(“<table class=’results’>”);
while($row = mysql_fetch_array( $result )) {
printf(“<tr><td class=’lefcol’>%s %s %s</td><td><b>Price:</b> $%s</td></tr>”, $row[“Company”], $row[“Name”], $row[“ModelNum”], $row[“Price”]);
}
printf(“</table>”);
This, the 1st query, orders by “Price,” but I want to display info from a different query when the checkbox is checked. Is there a way to do this via Javascript onClick? Or is there a better way to organize and display this data?
Thanks for your help.