Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html><head><title>Test Pulsa</title>
- <script type=text/javascript src='jquery-1.9.1.min.js'></script>
- <script type=text/javascript>
- $(document).ready(function() {
- $('#mprod').change(function() {
- var id=$(this).val();
- var dataString = 'id_prod='+ id;
- $.ajax ({
- type: 'POST',
- url: 'searchdonk.php',
- data: dataString,
- cache: false,
- success: function(response) {
- $('#sprod').html(response);
- }
- });
- });
- });
- </script>
- </head>
- <body>
- <center>
- <br><br>
- <br><br>
- <table border=1>
- <tr>
- <th>produk</th>
- <th>sub produk</th>
- <th>proses</th>
- </tr>
- <form name=refill action=isidonk.php method=post>
- <tr>
- <td><select name=mprod id=mprod>
- <?php
- $ip = 'localhost';
- $username = 'blabla';
- $password = 'blublu';
- $database = 'bleble';
- $mysqlId = mysqli_connect($ip,$username,$password,$database);
- $query = "select * from mproduk order by id_prod";
- $result = mysqli_query($mysqlId,$query);
- while(list($p_id,$nama,$ket) = mysqli_fetch_row($result))
- echo "<option value='$p_id'>$nama [ $ket ]</option>\n";
- mysqli_free_result($result);
- echo "</select></td>
- <td><select name=sprod id=sprod>\n";
- $query = "select id_sub,nama_sub,harga from msubproduk where id_prod=1 order by id_sub";
- $result = mysqli_query($mysqlId,$query);
- while(list($s_id,$nama,$harga) = mysqli_fetch_row($result)) {
- $price = number_format($harga,0,',','.');
- echo "<option value='$s_id'>$nama [ Harga $price ]</option>\n";
- }
- mysqli_free_result($result);
- ?>
- </select></td>
- <td><input type=submit value=submit></td>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment