I have been trying to extract data from a database and fill in a drop down list generated by JavaScript. However the PHP code doesn't seem to work at all. Here is the snippet code I am working with:
<script type="text/javascript">
$(document).ready( function () {$('#mainTable').dataTable({}).makeEditable({
"aoColumns": [
{
indicator: 'Saving Items...',
tooltip: 'Click to select Items',
loadtext: 'loading...',
type: 'select',
onblur: 'submit',
<?php
$item_set = get_all_items();
while($item = mysql_fetch_array($item_set)){
?>
data: "{'0':'Please select...', '1':'A'+' <? echo $item["item_desc"] ?> '}",
<?php
}
?>
sUpdateURL: function(value, settings){
alert("Custom function for posting results");
return value;
}
},
{
}
]
});
} );
</script>
I have tried the code in a simple HTML form and it works just fine. Btw I am using jQuery editable datatable http://code.google.com/p/jquery-datatables-editable/wiki/Overview
I just want to populate the select menu with data from the database. Any help is appreciated.
Here is the generated page: I the first column of the table, the drop down list must also have item description from DB.