nasirmunir
03-25-2009, 04:10 PM
I want to populate one drop down with another.
The two drop downs are Projects, and Tasks. If a user select a project, the tasks should populate according to the project selected.
I can populate task list on the basis of project id, but I don't know how to refresh that list every time a different project is selected. Any help? direction?
my project drop down:
<select name="pid">
[INDENT][INDENT][INDENT]<?
while ($row=mysql_fetch_array($resultProject)) {
$pid=$row["pid"];
$value=$row["project_name"];
?>
<option value="<?=$pid?>" ><?=$value?></option>
<? }
?>
</select>
and my tasks drop down:
<select name="tid">
<?
$sqlTask="SELECT * from tasks where pid=$pid ;";
$resultTask=mysql_query($sqlTask);
$optionsTask="";
while ($row=mysql_fetch_array($resultTask)) {
$pid=$row["tid"];
$value=$row["task_name"];
?>
<option value="<?=$tid?>"><?=$value?></option>
<? }
?>
</select>
The two drop downs are Projects, and Tasks. If a user select a project, the tasks should populate according to the project selected.
I can populate task list on the basis of project id, but I don't know how to refresh that list every time a different project is selected. Any help? direction?
my project drop down:
<select name="pid">
[INDENT][INDENT][INDENT]<?
while ($row=mysql_fetch_array($resultProject)) {
$pid=$row["pid"];
$value=$row["project_name"];
?>
<option value="<?=$pid?>" ><?=$value?></option>
<? }
?>
</select>
and my tasks drop down:
<select name="tid">
<?
$sqlTask="SELECT * from tasks where pid=$pid ;";
$resultTask=mysql_query($sqlTask);
$optionsTask="";
while ($row=mysql_fetch_array($resultTask)) {
$pid=$row["tid"];
$value=$row["task_name"];
?>
<option value="<?=$tid?>"><?=$value?></option>
<? }
?>
</select>