I\'m sort of experienced with PHP and MySQL so I kind of get the hang of things, however I\'m sort of trying to get something that may be over my level (not really sure the diff
Create a div and give it a id="result"
and put an empty select tag in that div.
Then using jQuery + Ajax, get the second dropdown using:
$('select[name="user"]').change(function(){
var user = $(this).val();
$.ajax({
type:'post',
url:'getSecondDropDown.php',
data:'user='+user,
success:function(result){
$('div#result').html(result);
}
});
});
In your 'getSecondDropDown.php' file, include this:
<select name="task">
<?php
$user = $_POST['user'];
$q = mysql_query("SELECT task FROM tablename WHERE user=".$user.") or die();
while($r = mysql_fetch_array($q))
{ ?>
<option value="<?php echo $r['task]; ?>"><?php echo $r['task]; ?></option>
<?php
}
?>
</select>
You'll need to use JavaScript to do it. Send an AJAX request to a page in the server which will fetch the details of a user for you, then return the results to JavaScript.
Once you have the data in your JavaScript, use DOM manipulation to populate the second <select>
with the results.