I want to build a simple search system.
I have this one page call search.php which I had a multiple select box that i retrieve from the database..
some of the code are like this:
<form 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 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 name="class" id="kelas">
<?
$db=mysql_connect($hostname,$username,$password);
mysql_select_db($dbname,$db);
$query = "SELECT * from execdipclass";
$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>
</tr>
<tr>
<td>Module:</td>
<td><select name="subject" id="subjek">
<?
$db=mysql_connect($hostname,$username,$password);
mysql_select_db($dbname,$db);
$query = "SELECT * from modul";
$record = mysql_query($query);
$numrows = mysql_num_rows($record);
if($numrows>0)
{
while($row = mysql_fetch_array($record))
{
$sub_id = $row['M_ID'];
$sub_name = $row['M_Desc'];
echo("<option value='$sub_name'>".$sub_id."</option>");
}
}
?>
</select></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="generate" value="Display" />
</div></td>
</tr>
</table>
</form>
On the next page..I want to retrieve data from database according to the selected data from search.php. Can anyone tell me how to code it? I've use the regular POST method but it didn't work
Please Help