Ads

Ads Here

Rabu, 09 September 2020

BELAJAR PHP - Combobox Multiple Select dari DATABASE Part 3

BELAJAR PHP - Combobox Multiple Select dari DATABASE

Langsung aja bos ku, berikut sorce code nya

<? include "koneksi.php";?>
<html>
<head>
<title>JQuery Multiple Select</title>
<script src="libs/jquery.min.js"></script>
<script src="libs/jquery.multiple.select.js"></script>
<link rel="stylesheet" href="libs/multiple-select.css"/>
<script>
$(document).ready(function(){
$('#dengan_plugin').multipleSelect({
placeholder: "Pilih Buah",
filter:true
});
});
</script>
</head>
<body>
<h1>JQuery Multiple Select Dari Database</h1>
<h2>Demo Part 3 : Combobox dengan Placeholder dan Filter dari Database</h2>
<form action="" method="post">
<select id="dengan_plugin" name="dengan_plugin[]" multiple="multiple" style="width:300px">
<?php
    $result = mysql_query("select * from buahbuahan   ORDER BY buah");   
    $jsArray1 = "var dtMhs1 = new Array();\n";       
    while ($row = mysql_fetch_array($result)) {   
        echo '<option value="' . $row['id'] . '">' . $row['buah'] . '</option>';   
        $jsArray1 .= "dtMhs1['" . $row['id'] . "'] = {
procedure1:'" . addslashes($row['buah']) 
"'};\n";   
    }     
    ?>   
</select>
<input type="submit" name="Pilih" value="Pilih"/>
</form>
</body>
</html>




Download Surce code

Demo Video

 

Tidak ada komentar:

Posting Komentar