I am trying to use a dropdown list to populate another dropdown list. In the first list, I select an `access_level`, and I would like to use this value to populate all of the available `cards` that have that access level associated with them. I can produce the list of access levels; however, the second dropdown list is never populated.

Here is the Javascript code:

```
    <script>
    $(document).ready(function() {
         $("#access_level").on("change", function(){
            var accessLevel = document.getElementById("access_level").value;
            $.post('getcard.php', { access: accessLevel }, function(result) {
                $('#card').html(result);
            }
              );
             });
    }); 
    </script>

```

The HTML code:

```
  <tr>
  <td align="right">Access Level:</td>
  <td><label>
  <select name='access_level' id='access_level'>
  <?if($accesslevel == 0){?>
  <option value='99' selected="selected" >No Access Selected</option>
  <? }else{ ?>
   <option value='<? echo $accesslevel;?>' selected="selected" ><? echo $accesslevel;?>  </option>
  <?}?>
  <? while ($row = $accesslevels->fetch_array()) {?>
    <option value='<? echo $row['access_level']?>'><? echo $row['access_level']; ?></option>
  <?}?>
  </select>
  </label></td>
  </tr>

  <tr>
  <td align="right">Availible Cards:</td>
  <td><label>
  <select name='card' id='card'>
  <?if($oldcardnum == "Empty"){?>
  <option value='99999999' selected="selected" >No Card</option>
  <? }else{ ?>
   <option value='<? echo $oldcardnum;?>' selected="selected" ><? echo $oldcardnum;?></option>
  <?}?>
  <option value='99999999'>No Card</option>

  <option value="empty">&nbsp;</option>
  </select>
  </label></td>
  </tr>

```

And the associated PHP file:

```
<?php
require_once "class/class.Database.php"; 
$db = new Database();
$db->connect();

if($_GET['access'])
{
    $access_level = $_REQUEST['access'];
$query = $db->mysqli->query("SELECT * FROM card_table WHERE access_level = '$access_level'");

while($row = $query->fetch_array()){ ?>
        <option value='<? echo $row['card_num']?>'><? echo $row['card_num']; ?></option>
<?}

}
?>

```

I tried to debug a bit by putting a simple `echo` statement at the beginning of the php file to see if it was ever getting inside the `if` statement, but nothing ever printed. I guess the request inside the php file is never reached? Why might this happen and how can I fix it?