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:
PHP Code:
echo "<th><select name='A' id='A' onChange='" . theAFunction() . "'>
<option value='1'>1</option>
<option value='2'>2</option>
</select></th>";
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 "<tr>";
echo "<td>" . $row[aye] . "</td>";
echo "<td>" . $row[bee] . "</td>";
echo "</tr>";
function theAFunction()
{
// 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'];
}
function theBFunction()
{
$b = $_POST['B'];
}
.
.
.
The above code returns errors on the $_POST lines (to be expected since nothing has been sent to the server).
I'm more used to the javascript DOM, and it seems like I do need to pass the results back to javascript somehow to do this without submitting a form - but then I think I will run in to a problem with getting js to update the query results from the database.
Any help would be appreciated.