Q:

Populating a select box

I'm using this plugin to style my selectboxes. I have a PHP script that fetches the select option like so:
$varGSM = $_POST['GSM'];

and the HTML:
<select name="GSM">
  <option>1</option>
  <option>2</option>
</select>

Although it seems as the plugin doesn't really populate the select box at all. Does anyone know how I could make this happen using jQuery?

A:

PHP runs on the server - JavaScript runs on the client. You need to pass the data from the server to the client before attempting to use such a JavaScript library to build your select box.
If I understand what you are trying to accomplish, you can try:
<?php
    $varGSM = $_POST['GSM'];
    echo('<select name="GSM">');
    for($i = 1; $i < 3; $i++)
    {
        echo('<option'.($varGSM == $i ? 'selected="selected"':'').'>' . $i . '</option>');
    }
    echo('</select>');
?>

