PHP + MYSQL filter query results dynamically (without sending back to the server)
Hello, I have a database I am trying to perform some filtering on. The default display is all of the records (working - or was before I tried what I'm about to post), and I have some inputs (drop downs, text fields) I'd like to change the state of and have the results update - hopefully without the use of a submit button. Here's basically what I'm trying to do.
Basic PHP code:
The above code returns errors on the $_POST lines (to be expected since nothing has been sent to the server).
echo "<th><select name='A' id='A' onChange='" . theAFunction() . "'>
echo "<th><input type='text' name='B' id='B' onChange='" . theBFunction() . "'></input></th>";
$a = '%'; // Setting the variables to match all the records first
$b = '%';
$c = '%';
$d = '%';
$filter = "SELECT * FROM table WHERE aye LIKE '" . $a . "' AND bee LIKE '" . $b . "' AND cee LIKE '" . $c . "' ORDER BY aye";
$result = mysql_query($filter);
while ($row = mysql_fetch_array($result))
echo "<td>" . $row[aye] . "</td>";
echo "<td>" . $row[bee] . "</td>";
// trying incorrectly to get the values of the fields as they are changed,
// obviously $_POST doesn't work but this is where my problem is
$a = $_POST['A'];
$b = $_POST['B'];
Any help would be appreciated.