Here's what I've got. I'm trying to have jquery run a mysql query.
This is my PHP:
<select name="kingdom" id="kingdom" >
<option value="standard">-- Kingdom --</option>
<?php
$the_d = $_POST['d'];
$filter = mysql_query("SELECT DISTINCT sci_kingdom FROM tbl_lifedata WHERE sci_domain = '$the_d'");
while($row = mysql_fetch_array($filter, MYSQL_NUM))
{
$row['name'];
//echo "<option value='$row[0]'>$row[0]</option>";
}
?>
</select>
And my jQuery:
$('#domain').change(function () {
var selectval = $('#domain').val();
$.post("search.php", {
d: selectval
}, function (data) {
$('.result').html(data);
});
});
Right now I would just like to have jQuery spit out the values of the mysql result. When I have that working, I can have them populate a select box. What I get now is the html of search.php but nothing to do with the mysql query.
$row['name']
in the fetch loop. You're using numeric keys in the fetch, so$row['name']
wouldn't be set anyway. – Michael Berkowski Jun 21 '12 at 1:35