thank you for all the reply.
however i ad somethign else to my code.
I add onChange statement at the dropdown menu.
so code become like this,
<form name="modulartabulate" method="post" action="modulartabulated.php">
<table width="75%" border="0" align="center">
<tr>
<td>Date:</td>
<td><input type="text" name="date" /></td>
</tr>
<tr>
<td>Examiner:</td>
<td><input type="text" name="examiner" /> </td>
</tr>
<tr>
<td>Program:</td>
<td><select oncahnge="modulartabulted.submit()" name="program" id="prog">
<?
$db=mysql_connect($hostname,$username,$password);
mysql_select_db($dbname,$db);
$query = "SELECT * from execdipprog";
$record = mysql_query($query);
$numrows = mysql_num_rows($record);
if($numrows > 0 )
{
while($row = mysql_fetch_array($record))
{
$prog_id = $row['K_Name'];
$prog_name = $row['K_Desc'];
echo("<option value='$prog_name'>".$prog_name."</option>");
}
}
?>
</select></td>
</tr>
<tr>
<td>Class</td>
<td><select modulartabulted.submit() name="class" id="kelas">
<?
$db=mysql_connect($hostname,$username,$password);
mysql_select_db($dbname,$db);
$query = "SELECT * from execdipclass where K_Name='program'";
$record = mysql_query($query);
$numrows = mysql_num_rows($record);
if($numrows > 0)
{
while($row = mysql_fetch_array($record))
{
$class_id = $row['C_Id'];
$class_name = $row['C_Name'];
echo("<option value='$class_name'>".$class_name."</option>");
}
}
?>
</select></td>
My problem is, I want the 2nd select option (drop down menu) to list the data from database according to the 1st select option (drop down menu). Using the coding above, after I selected the 1st select option (drop down menu), it redirect to the "modulartabulted.php" which suppose to happend after I click the submit button after I finish select from all the drop down list menu.
to clear it all out I'll show from example
according to the image that i've attach, i want to list out data from the database. Here a the step by step.
1. First I select Program (A)
2. Then Class (B) will list its data according to Program (A)
3. After I select Class (B), Student Name (C) will list it data according to the Class (B) that I choose.
4. Module (D) will list its data according to the Program (A) that I choose earlier.
5. After finish selecting, I click display button and it will be directed to "modulartabulated.php" page where all the date been sort according to the data I selected in previous page.
All of above happen to be in the same form.
Please help.
Thank you in advanced.