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
Expand|Select|Wrap|Line Numbers
- <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>