Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Document</title>
- <script type='text/javascript' src='http://code.jquery.com/jquery-2.1.3.js'></script>
- <script>
- //<![CDATA[
- $(window).load(function(){
- $("#harga").on("change", function(){
- var nilai = $("#harga :selected").attr("data-harga");
- $("#hasil").val(nilai);
- });
- });//]]>
- </script>
- </head>
- <body>
- <select id="harga">
- <option value="">Pilih</option>
- <?php
- include "config.php";
- $pos=mysql_query("SELECT * from t_pelanggan order by no_pelanggan");
- while ($r_pos=mysql_fetch_array($pos)) {
- ?>
- <option value="<?php echo $r_pos['no_pelanggan'] ?>" data-harga="<?php echo $r_pos['nama'] ?>"><?php echo $r_pos['no_pelanggan'] ?></option>
- <?php
- }
- ?>
- </select>
- <br>
- <input type="text" id="hasil">
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement