justhrun

pulsa_index.pehape

Aug 27th, 2014
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.99 KB | None | 0 0
  1. <html><head><title>Test Pulsa</title>
  2. <script type=text/javascript src='jquery-1.9.1.min.js'></script>
  3. <script type=text/javascript>
  4. $(document).ready(function() {
  5.         $('#mprod').change(function() {
  6.                 var id=$(this).val();
  7.                 var dataString = 'id_prod='+ id;
  8.  
  9.                 $.ajax ({
  10.                         type: 'POST',
  11.                         url: 'searchdonk.php',
  12.                         data: dataString,
  13.                         cache: false,
  14.                         success: function(response) {
  15.                                 $('#sprod').html(response);
  16.                         }
  17.                 });
  18.         });
  19. });
  20. </script>
  21. </head>
  22. <body>
  23. <center>
  24. <br><br>
  25. <br><br>
  26. <table border=1>
  27. <tr>
  28.         <th>produk</th>
  29.         <th>sub produk</th>
  30.         <th>proses</th>
  31. </tr>
  32. <form name=refill action=isidonk.php method=post>
  33. <tr>
  34.         <td><select name=mprod id=mprod>
  35. <?php
  36.         $ip = 'localhost';
  37.         $username = 'blabla';
  38.         $password = 'blublu';
  39.         $database = 'bleble';
  40.         $mysqlId = mysqli_connect($ip,$username,$password,$database);
  41.  
  42.         $query = "select * from mproduk order by id_prod";
  43.         $result = mysqli_query($mysqlId,$query);
  44.         while(list($p_id,$nama,$ket) = mysqli_fetch_row($result))
  45.                 echo "<option value='$p_id'>$nama [ $ket ]</option>\n";
  46.         mysqli_free_result($result);
  47.  
  48.         echo "</select></td>
  49.        <td><select name=sprod id=sprod>\n";
  50.         $query = "select id_sub,nama_sub,harga from msubproduk where id_prod=1 order by id_sub";
  51.         $result = mysqli_query($mysqlId,$query);
  52.         while(list($s_id,$nama,$harga) = mysqli_fetch_row($result)) {
  53.                 $price = number_format($harga,0,',','.');
  54.                 echo "<option value='$s_id'>$nama [ Harga $price ]</option>\n";
  55.         }
  56.         mysqli_free_result($result);
  57. ?>
  58.         </select></td>
  59.         <td><input type=submit value=submit></td>
  60.         </tr>
  61. </table>
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment