I have 2 dynamic PHP dropdowns:
The second dropdown populates from the first, depending on what is selected in the first.
The page is showing issues in a department:
The first dropdown consists of departments- It has 3 options All issues, dept A, dept B
If dept A is chosen in the first dropdown, the second dropdown shows all members in dept A and all issues are shown for dept A are shown below.
Now if i choose a member in second dropdown, i want issues owned by this member to show up.
code:
[code=php]
<?php
//db connection file goes here
if (isset($_GET["first"]))
{
$first =$_GET["first"];
}
if (isset($_GET["second"]))
{
$second =$_GET["second"];
}
?>
<HTML>
<script language="JavaS cript">
function mySubmit()
{
var formObject = document.forms['myform'];
formObject.subm it();
}
<?php
</HEAD>
<BODY>
<form name="myform" method="get">
<p>Please select a dept
<select name="first" onChange ="mySubmit() ;">
<option value="NULL"></option>
<?php
//get members from db depending on what dept is selected
echo '</SELECT>';
if($first != null)
{
?>
Please select a member:
<select name="second" onChange="mySub mit();">
//get option values from db
echo '</SELECT>';
}
//if dept selected show issues for that dept
//if member selected show issues only for that member
</TABLE>
</BODY>
</HTML>
[/code]
Any help is appreciated.
Thank you.
The second dropdown populates from the first, depending on what is selected in the first.
The page is showing issues in a department:
The first dropdown consists of departments- It has 3 options All issues, dept A, dept B
If dept A is chosen in the first dropdown, the second dropdown shows all members in dept A and all issues are shown for dept A are shown below.
Now if i choose a member in second dropdown, i want issues owned by this member to show up.
code:
[code=php]
<?php
//db connection file goes here
if (isset($_GET["first"]))
{
$first =$_GET["first"];
}
if (isset($_GET["second"]))
{
$second =$_GET["second"];
}
?>
<HTML>
<script language="JavaS cript">
function mySubmit()
{
var formObject = document.forms['myform'];
formObject.subm it();
}
<?php
</HEAD>
<BODY>
<form name="myform" method="get">
<p>Please select a dept
<select name="first" onChange ="mySubmit() ;">
<option value="NULL"></option>
<?php
//get members from db depending on what dept is selected
echo '</SELECT>';
if($first != null)
{
?>
Please select a member:
<select name="second" onChange="mySub mit();">
//get option values from db
echo '</SELECT>';
}
//if dept selected show issues for that dept
//if member selected show issues only for that member
</TABLE>
</BODY>
</HTML>
[/code]
Any help is appreciated.
Thank you.
Comment