its easy to place an array values in the combo box.
but i need to know how can i do it if i have to retrieve the values from a database.
my platform is PHP MySql. please i need help :(
combo box name=dep_list_selected
database name = dependency.
if i choose value 'A' then the corresponding values of it that are stored in the table should appear in the combo box.
if i choose another option then its respective values should be displayed.
So you can see it :
Name:
</td>
<?php
$query = "select last_name,first_name
from student
order by first_name ";
$search_stu=mysql_query($query)or die(mysql_error());
$name = array();
//last name into array
while ($rowN = mysql_fetch_assoc($search_stu))
{
array_push($name, $rowN["last_name"]);
}
?>
<?php //list of name ?>
<td>
<select name="name">
<option value=" "></option>
<?php foreach($name as $valueN) { ?>
<option value="<?= $valueN ?>" <? if ($HTTP_POST_VARS['last_name'] == $valueN){ echo "SELECTED";}?>><?= $valueN ?></option>
<? }
?>