ok this is wat i was trying to do...i have a list field with options A,B,P now i want the second list field to show data list by getting them from database based on the selection made in listbox1.
e.g if i select A in listbox 1 then listbox 2 should display automatically all the data from database where the status is A.
and as i change the seelction it should display different data accordingly.
but in my code it doesnt display any data in the listbox2
plz help
e.g if i select A in listbox 1 then listbox 2 should display automatically all the data from database where the status is A.
and as i change the seelction it should display different data accordingly.
but in my code it doesnt display any data in the listbox2
plz help
Code:
<body>
<div style="position: absolute; width: 100px; height: 32px; z-index: 1; left: 225px; top: 5px" id="layer1">
<td><select name="status" maxlength="1">
<?php
echo '<option>'.A.'</option>';echo "<BR>";
echo '<option>'.P.'</option>';echo "<BR>";
echo '<option>'.B.'</option>';echo "<BR>";
?>
</select> </td>
</div>
<form action="listpopulate.php" method="post">
<table>
<td><select name="username" maxlength="23">
<?php
$username = 'username';
$usernamevalue = array();
$status = 'status';
$query_name = "SELECT users.username FROM users WHERE users.status='".mysql_real_escape_string($status)."'";
$result = mysql_query($query_name);
confirm_query($result);
while ($record = mysql_fetch_assoc($result)) {
while (list($username, $usernamevalue) = each ($record)) {
echo '<option>'.htmlentities($usernamevalue).'</option>';
}
echo "<BR>";
}
?>
</select> </td>
</div>
</table>
</form>
</body>
Comment