too long

I've been experimenting with chosen and was using it with data from MySQL database. I stumbled upon a problem when using a selected value in hope for updating it's previous value. Here's my code:

<label>Client
<select data-placeholder="Choose a client..." class="chosen-select" style="width:350px;" tabindex="2" name="client">
<option value=""></option>
<?php 
$cno=$h['client-no'];
$c=mysql_query("select * from `clients`") or die(mysql_error());
while($d=mysql_fetch_array($c))
{   
    ?>
        <option value="<?php echo $d['client-name']; ?>" <?php if ($d['client-no']==$cno) { ?>selected="selected"<?php } ?>>
            <?php echo htmlspecialchars($d['client-name']); ?>
        </option>
    <?php
}
?>
</select>
</label>

But it doesn't work. What am I doing wrong?

I'll go for the straight forward approach here...

  • Did you import jQuery and Chosen into the page?
  • I don't see any JS in the source you pasted in, did you initialize the jQuery-chosen? ($(".chosen-select").chosen())?
  • Does your JS console show any errors? If so, what errors?