Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

populating dropdown box with json data

$
0
0
i have got this code so far but it don't seem to be doing what i need, i have followed a few examples but this is what ive done at top of my head. hope someone can help. just need to populate the table now

<title>Untitled Document</title>
</head>

<script src="jquery.js"></script>
<script src="jquery.jCombo.js"></script>
<style type="text/css">
</style>

<?php
$directory = opendir("C:/xampp/htdocs/SE3S604CW3/xml");

$storeFilesIntoArray[] = "please select XML to load";

while (($fileName = readdir($directory)) !== false)
{
 $getLastFourDigitsOfFile = substr($fileName,-4); 
 
 if($getLastFourDigitsOfFile == ".xml")
 {
  #echo "filename is " . $fileName . "<br/>";
    $storeFilesIntoArray[] = $fileName;
 }
}
$json = json_encode($storeFilesIntoArray);
echo $json;
//close directory and print the contents of the array to check if its working.
closedir($directory);

?>

<body>

<script type="text/javascript">

$(document).ready(function(){
	$("#list1").jCombo($json, {} );

});

</script>

<select name="list1" id="list1"></select><br><br>

</body>
</html>

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>