Hi

Basically I have downloaded a script that converts a drop down list into checkboxes. I have the code working fine, but I'm having difficulty in passing what is checked/selected to a PHP loop to upload to a MySQL database.

The form element is this:

Code:
<label for="Borough">Domiciliary service available in the following Boroughs</label>
<select class="selectlong" multiple="multiple" name="borcodes[]" id="Borough"> 
        <?
                $BRQuery = @mysql_query ("SELECT * FROM B_TABLE ORDER BY Title ASC",$mdbc);
                while ($BRPrint = mysql_fetch_array ($BRQuery)) {
        ?>
                <option value="<?php echo $BRPrint['BCode'] ?>"><?php echo $BRPrint['Title'] ?></option>
        <? } ?>
</select>
The JavaScript function to change the dropdown to a checkbox is this:

Code:
<script>
$( document ).ready(function() {
	$("#Borough").multiselect({
	   position: {
		  my: 'left bottom',
		  at: 'left top'
	   },
		noneSelectedText: "No Boroughs chosen",
		selectedText: "# of # Boroughs chosen",
		show: ['fade', 600],
		height: 260
	});
});
</script>
And the PHP loop is this:

Code:
$BCodes = mysql_real_escape_string($_POST['borcodes']);
$SPCodeQuery = mysql_query ("SELECT SPCode FROM S_TABLE ORDER BY SPCode DESC LIMIT 1",$mdbc);
$SPCodePrint = mysql_fetch_array ($SPCodeQuery);
$SPCode = $SPCodePrint['SPCode'];
if (isset($BCodes)) {
	foreach ($BCodes as $borcodes) {
		$InsertB = mysql_query ("INSERT INTO TABLE_B_V_S (BCode, SPCode) VALUES ('".$borcodes."','".$SPCode."');");
	}
}
The developer of the code said to use:

Code:
$( document ).ready(function() {
		var array_of_checked_values = $("#Borough").multiselect("getChecked").map(function(){
			 return this.value;    
		}).get();
});
But I'm not quite sure if this should go into the original function or on it's own.

Does anyone know what I need to do to get the checked boxes into an array and then pass this array to PHP please?

Cheers
G