sore mas mo nanya dunk
saya mau menampilkan hasil query dari 4 tabel yg terelasi misal saya masukkan medrecnya data2 yag lain keluar
tabel saya
1. datasosial(medrec(pk), nama, tgllahir)
2. kunjungan(idkunjungan(pk), medrec, diagutama, diasekunder)
3. icd10(kd_penyakit(pk), penyakit)
4. icd10b (kd_penyakit(pk), penyakit)
relasi
1. datasosial(medrec)= kunjungan(medrec)
2. kunjunagan(diagutama)=icd10(kd_penyakit)
3. kunjungan(diasekunder)=icd10b(kd_penyakit)

sql saya berjalan dimysql
SELECT kunjungan.idkunjung, kunjungan.medrec, kunjungan.masuk, kunjungan.keluar, kunjungan.jnsrawat, kunjungan.jnskunjung, kunjungan.carakeluar, kunjungan.diagutama, kunjungan.diasekunder, datasosial.nama, datasosial.tglahir, datasosial.umurthn, datasosial.umurhari, datasosial.jnskelamin, datasosial.bblahir, icd10.penyakit AS diagnosautama, icd10b.penyakit AS diagnosasekunder FROM kunjungan, datasosial, icd10, icd10b WHERE kunjungan.diagutama=icd10.kd_penyakit AND kunjungan.diasekunder=icd10b.kd_penyakit AND datasosial.medrec=kunjungan.medrec AND kunjungan.medrec='0000001'
tp kl pake scrip kede dibawah muncul keterangan "Column 'medrec' in where clause is ambiguous"
  1. <!DOCTYPE html>
  2. <html >
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. <style type="text/css">
  7. <!--
  8. body {
  9. font: 100% Verdana, Arial, Helvetica, sans-serif;
  10. background: #666666;
  11. margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
  12. padding: 0;
  13. text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
  14. color: #000000;
  15. }
  16. .oneColFixCtrHdr #container {
  17. width: auto; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
  18. background: #FFFFFF;
  19. margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
  20. border: 1px solid #000000;
  21. text-align: left; /* this overrides the text-align: center on the body element. */
  22. }
  23. .oneColFixCtrHdr #header {
  24. background: #DDDDDD;
  25. padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
  26. }
  27. .oneColFixCtrHdr #header h1 {
  28. margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
  29. padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
  30. }
  31. .oneColFixCtrHdr #mainContent {
  32. padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
  33. background: #FFFFFF;
  34. }
  35. .oneColFixCtrHdr #footer {
  36. padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
  37. background:#DDDDDD;
  38. }
  39. .oneColFixCtrHdr #footer p {
  40. margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
  41. padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
  42. }
  43. -->
  44. </style></head>
  45.  
  46. <body class="oneColFixCtrHdr">
  47.  
  48. <div id="container">
  49. <div id="header">
  50. <h1>Resume</h1>
  51. <!-- end #header --></div>
  52. <div id="mainContent">
  53. <h1>HASIL</h1>
  54.  
  55. <?php
  56. error_reporting("E_ALL ^ E_NOTICE");
  57. mysql_connect("localhost", "root", "");
  58. mysql_select_db("datapx");
  59.  
  60. $bagianWhere = "";
  61.  
  62. if (isset($_POST['medrec']))
  63. {
  64. $medrec = $_POST['medrec'];
  65. if (empty($bagianWhere))
  66. {
  67. $bagianWhere .= "medrec = '$medrec'";
  68. }
  69. else
  70. {
  71. $bagianWhere .= " AND medrec LIKE '$medrec'";
  72. }
  73. }
  74.  
  75.  
  76.  
  77.  
  78. $query = "SELECT kunjungan.idkunjung, kunjungan.medrec, kunjungan.masuk, kunjungan.keluar, kunjungan.jnsrawat, kunjungan.jnskunjung, kunjungan.carakeluar, kunjungan.diagutama, kunjungan.diasekunder, datasosial.nama, datasosial.tglahir, datasosial.umurthn, datasosial.umurhari, datasosial.jnskelamin, datasosial.bblahir, icd10.penyakit AS diagnosautama, icd10b.penyakit AS diagnosasekunder FROM kunjungan, datasosial, icd10, icd10b WHERE kunjungan.diagutama=icd10.kd_penyakit AND kunjungan.diasekunder=icd10b.kd_penyakit AND datasosial.medrec=kunjungan.medrec AND kunjungan.medrec=".$bagianWhere;
  79. $hasil = mysql_query($query) or die (mysql_error());
  80.  
  81.  
  82. echo "<table border='1' cellpadding = '2' cellspacing = '1' align = 'left'>";
  83. echo "<tr><td>id kunjungan</td><td><tr><td>MEDREC</td><td>NAMA</td></td><td>TGL MASUK</td><td>TGL KELUAR</td><td>JENIS KELAMIN</td><td>TGL Lahir</td><td>UMUR TAHUN</td>
  84. <td>UMUR HARI</td><td>JENIS KUNJUNGAN</td><td>JENIS PERAWATAN</td><td>CARA KELUAR RS</td><td>BERAT BADAN LAHIR</td><td>DIAGNOSA UTAMA</td> <td>ICD10</td><td>DIAGNOSA SEKUNDER</td><td>IC10</td></tr>";
  85.  
  86. while ($data = mysql_fetch_array($hasil))
  87. {
  88. echo "<tr><td>".$data['idkunjung']."</td><td>".$data['medrec']."</td><td>".$data['nama']."</td><td>".$data['masuk']."</td><td>".$data['keluar']."</td><td>".$data['jnskelamin']."</td><td>".$data['tglahir']."</td>
  89. <td>".$data['umurthn']."</td><td>".$data['umurhari']."</td><td>".$data['jnskunjung']."</td><td>".$data['jnsrawat']."</td><td>".$data['carakeluar']."</td><td>".$data['bblahir']."</td><td>".$data['penyakit']."</td>
  90. <td>".$data['kd_penyakit']."</td><td>".$data['diasekunder']."</td><td>".$data['kd_penyakit']."</td></tr>";
  91. }
  92. echo "</table>";
  93. ?>
  94. <!-- end #mainContent --></div>
  95. <div id="footer">
  96. <table width="317" border="1" >
  97. <tr>
  98. <th width="107" height="32" align="left" scope="row">TANGGAL : </th>
  99. <td width="199"><span id="date"><?php print date('d-m-Y'); ?></span></td>
  100. </tr>
  101. <tr>
  102. <th height="40" align="left" scope="row">JAM :</th>
  103. <td><script type="text/javascript">
  104. //set timezone
  105. <?php date_default_timezone_set('Asia/Jakarta'); ?>
  106. //buat object date berdasarkan waktu di server
  107. var serverTime = new Date(<?php print date('Y, m, d, H, i, s, 0'); ?>);
  108. //buat object date berdasarkan waktu di client
  109. var clientTime = new Date();
  110. //hitung selisih
  111. var Diff = serverTime.getTime() - clientTime.getTime();
  112. //fungsi displayTime yang dipanggil di bodyOnLoad dieksekusi tiap 1000ms = 1detik
  113. function displayServerTime(){
  114. //buat object date berdasarkan waktu di client
  115. var clientTime = new Date();
  116. //buat object date dengan menghitung selisih waktu client dan server
  117. var time = new Date(clientTime.getTime() + Diff);
  118. //ambil nilai jam
  119. var sh = time.getHours().toString();
  120. //ambil nilai menit
  121. var sm = time.getMinutes().toString();
  122. //ambil nilai detik
  123. var ss = time.getSeconds().toString();
  124. //tampilkan jam:menit:detik dengan menambahkan angka 0 jika angkanya cuma satu digit (0-9)
  125. document.getElementById("clock").innerHTML = (sh.length==1?"0"+sh:sh) + ":" + (sm.length==1?"0"+sm:sm) + ":" + (ss.length==1?"0"+ss:ss);
  126. }
  127. </script>
  128. <body onload="setInterval('displayServerTime()', 1000);">
  129. <br/>
  130. <span id="clock"><?php print date('H:i:s'); ?></span></td>
  131. </tr>
  132. </table>
  133. <a href="/ridha/index.php">Kembali ke halaman Sebelumnya</a>
  134. <!-- end #footer --></div>
  135. <!-- end #container --></div>
  136. </body>
  137. </html>
Please login to answer!
[ASK]
Sore mastah sekalian, ada yg mau saya tanyakan.
Saya tidak bisa delete data 3 Tabel sekaligus di page, namun query di jalankan di SQL bisa.
Mohon Pencerahan, please.
  1. <?php
  2. if ($_GET[mode]=="hapus"){
  3. $xx = getData("id_reg","tb_medik","id_reg='$_GET[id]'");
  4. if (!$xx[0]==""){
  5. mysql_query("DELETE tb_medik, tb_resep, tb_transaksi FROM tb_medik LEFT JOIN tb_resep ON tb_medik.id_reg=tb_resep.id_reg LEFT JOIN tb_transaksi ON tb_medik.id_reg=tb_transaksi.id_reg WHERE tb_medik.id_reg='$_GET[id]'");
  6. echo "<script>
  7. notifsukses('Success,'Data Telah Dihapus..!!');
  8. setTimeout('window.location.href=\"media.php?page=$page\"', 2000)
  9. </script>";
  10. }else{
  11. echo "<script>window.location=('media.php?page=$page')</script>";
  12. }
  13. }
  14. ?>
  15.  
  16. <div class="table-header">
  17. DATA REKAM MEDIK
  18. </div>
  19. <div class="row-fluid">
  20. <table id="myTable" class="table table-striped table-bordered table-hover">
  21. <thead>
  22. <tr>
  23. <th class="center" width="35px">No</th>
  24. <th class="center" width="90px">No. Registrasi</th>
  25. <th class="hidden-480 center">Nama Pasien</th>
  26. <th class="center" width="100px">Tanggal</th>
  27. <th class="hidden-480 center">Nama Dokter</th>
  28. <th class="hidden-480 center">Poliklinik</th>
  29. <th class="hidden-480 center">Diagnosa</th>
  30. <th class="center" width="100px">Pembayaran</th>
  31. <th class="hidden-480 center" width="40px">Aksi</th>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. <?php
  36. $qry = mysql_query("SELECT a.*, b.nm_pasien, c.nm_dokter FROM tb_medik a
  37. LEFT JOIN tb_pasien b ON a.id_pasien=b.id_pasien
  38. LEFT JOIN m_dokter c ON a.id_dokter=c.id_dokter
  39. ORDER BY a.id_reg DESC");
  40. while ($d = mysql_fetch_array($qry)){
  41. $tgl = getTglIndo($d[tgl_reg]);
  42.  
  43. $cSP = getNumRows("SELECT * FROM tb_medik WHERE diagnosa !=0");
  44. $spAlert = array(
  45. "0"=>"<a href='?page=$page&act=resep&id=$d[id_reg]'>
  46. <button class='btn btn-mini btn-success' class='tooltip-info' data-rel='tooltip' data-original-title='Resep'>
  47. <span class='white'> <i class='icon-leaf bigger-120'></i> </span>
  48. </button>
  49. </a>",
  50. "1"=>"".$d['diagnosa']."</span>"
  51. );
  52. $aSP = ($cSP>0 ? $spAlert["1"] : $spAlert["0"]);
  53.  
  54. $pRS = getNumRows("SELECT * FROM tb_medik WHERE jasa !=0");
  55. $psAlert = array(
  56. "0"=>"<a href='?page=$page&act=bayar&id=$d[id_reg]'>
  57. <button class='btn btn-mini btn-info' class='tooltip-success' data-rel='tooltip' data-original-title='Bayar'>
  58. <span class='white'>&nbsp;<i class='icon-dollar bigger-120'></i>&nbsp;</span>
  59. </button>
  60. </a>",
  61. "1"=>"".rupiah($d['jasa'])."</span>"
  62. );
  63. $pCS = ($pRS>0 ? $psAlert["1"] : $psAlert["0"]);
  64.  
  65. ?>
  66. <tr>
  67. <?php
  68. $no++;
  69. echo "
  70. <td class='center'>$no</td>
  71. <td class='center'>$d[id_reg]</td>
  72. <td class='center'>$d[nm_pasien]</td>
  73. <td class='center'>$tgl</td>
  74. <td class='center'>$d[nm_dokter]</td>
  75. <td class='center'>$d[nm_poli]</td>
  76. <td class='center'>$aSP</td>
  77. <td class='center'>$pCS</td>
  78. <td class='center'>
  79. <a href='?page=$page&mode=hapus&id=$d[id_reg]'><button class='btn btn-mini btn-yellow' onclick='return qh();' class='tooltip-error' data-rel='tooltip' data-original-title='Hapus'>
  80. <span class='red'><i class='icon-trash bigger-120'></i></span>
  81. </button></a></td>";
  82. ?>
  83. </tr>
  84. <?php
  85. }
  86. ?>
  87. </tbody>
  88. </table>
  89. </div>
Please login to answer!
Salam kenal mas, saya banyak belajar dari postingan di sini. Saya mau nnya dong mas. Kan saya bikin seperti kuesioner, ada daftar, trus jawab pertanyaan sama jawaban. Disina saya mau simpan jawaban ke database. Kendala yg saya temui, saat daftar data berhasil masuk ke database, saat menyimpan jawaban juga masuk ke database tapi id_user 0.
Gimana ya mas cara menyimpan jawaban dengan id_user sama. Mohon bantuannya mas
Tabel peserta id_user, nama, tanggal
Tabel pertanyaan, id_soal, pilihan_a, pilhihan_b, tipe_soal.
Tabel untuk jawabannya id_user, nilai_tipe1, nilai_tipe2.
Please login to answer!
Selamat malam, saya membuat form input soal. Table db soal dan jawaban terpisah, karena akan ditampilkan random. Tapi problem ada di input radiobutton untuk optionnya. Jawaban benar nilainya 1, masih bingung cara nyimpennya krn pakai array. Kalau isi dari option sudah bisa masuk db jawaban.
  1. $opsi = 4;
  2. For ($i=0; $i<opsi; $i++){
  3. Echo"
  4. <tr>
  5. <td><inout type='radio' name='jawaban$i'><textearea name='option[]'></textarea>
  6. </td>
  7. </tr>";
  8. }

mohon pencerahannya, urgent banget. Nyari sana sini gak nemu.
Please login to answer!
gimana cara biar ada peringatan stok kurang dari permintaan keluar??
  1. <?php
  2. error_reporting(0);
  3. error_reporting(E_ERROR | E_WARNING | E_PARSE);
  4. error_reporting(E_ALL);
  5. ini_set("error_reporting", E_ALL);
  6. error_reporting(E_ALL & ~E_NOTICE);
  7. ?>
  8. <?php
  9. //kondisi jika data SES_USER masih kosong maka...
  10. if (isset($_SESSION['SES_USER'])=="") {
  11. //merefresh halaman ke index.php
  12. echo"<meta http-equiv='refresh' content='0;url=index.php'>";
  13. } else { //jika SES_USER tidak kosong maka...
  14. include "koneksi.php"; //memanggil koneksi
  15. ?>
  16. <?php
  17. mysql_connect("localhost","root","");
  18. mysql_select_db("dbstok");
  19.  
  20. $query = "select max(id_trans_klr) as Kode from brg_klr";
  21. $hasil = mysql_query($query);
  22. $data = mysql_fetch_array($hasil);
  23. $kode = $data['Kode'];
  24.  
  25. $nourut = (int) substr($kode, 3, 3);
  26. $nourut++;
  27.  
  28. //karakter tetap
  29. $char = "OUT";
  30. //mengatur 02 karakter berubah-ubah
  31. $IdBaru = $char.sprintf("%03s",$nourut);
  32. ?>
  33.  
  34.  
  35. <style type="text/css">
  36. caption {font-size:x-large}
  37. </style>
  38.  
  39. <!-- link ke jQuery-1.4.4 -->
  40. <link rel="stylesheet" href="jQuery-1.4.4/bundle/themes/base/jquery.ui.all.css">
  41. <script type="text/javascript" src="jQuery-1.4.4/jscript/jquery-1.4.4.min.js"></script>
  42. <script type="text/javascript" src="jQuery-1.4.4/jscript/jquery-ui-1.8.9.custom.min.js"></script>
  43. <script type="text/javascript" src="jQuery-1.4.4/bundle/ui/jquery.ui.datepicker.js"></script>
  44.  
  45. <script> <!-- Javascript untuk fungsi kalender -->
  46. $(function() {
  47. $( "#tanggal" ).datepicker({
  48. changeMonth: true,
  49. changeYear: true,
  50. dateFormat:'yy-mm-dd',
  51. yearRange: '1980:c+9'
  52. });
  53. });
  54. </script>
  55. <style type="text/css">
  56. a {
  57. text-decoration: none;
  58. }
  59. .inputnonaktif {
  60. background-color:#6F9;
  61. }
  62. </style>
  63. <link href="thickbox/thickbox.css" rel="stylesheet" type="text/css" />
  64. <script language="javascript" src="jquery/jquery-1.2.6.js"></script>
  65. <script language="javascript" src="thickbox/thickbox.js"></script>
  66.  
  67. <script language="javascript">
  68.  
  69. var $jnoc = jQuery.noConflict();
  70. $jnoc(document).ready(function(){
  71. $jnoc("a.slick").click(function(){
  72. $jnoc(".active").removeClass("active");
  73. $jnoc(this).addClass("active");
  74. $jnoc(".content-slick").slideUp();
  75. var content_show = $jnoc(this).attr("title");
  76. $jnoc("#" +content_show).slideDown();
  77. });
  78. });
  79.  
  80.  
  81. function selectbarang(kode_brg,nama_brg,kualitas,id_suplier){
  82. $jnoc('input[@name=kode_brg]').val(kode_brg);
  83. $jnoc('input[@name=nama_brg]').val(nama_brg);
  84. $jnoc('input[@name=kualitas]').val(kualitas);
  85. $jnoc('input[@name=id_suplier]').val(id_suplier);
  86. tb_remove(); // hilangkan dialog thickbox
  87. }
  88.  
  89. function selectbrg_klr(kode_brg,nama_brg,kualitas,id_suplier){
  90. $jnoc('input[@name=kode_brg]').val(kode_brg);
  91. $jnoc('input[@name=nama_brg]').val(nama_brg);
  92. $jnoc('input[@name=kualitas]').val(kualitas);
  93. $jnoc('input[@name=id_suplier]').val(id_suplier);
  94. tb_remove(); // hilangkan dialog thickbox
  95. }
  96. </script>
  97.  
  98. <form name="frmSimpan" method="post" action="" enctype="multipart/form-data">
  99. <table width="450" align="center">
  100. <caption>INPUT BARANG KELUAR<br><br></caption>
  101. <tr>
  102. <td width="50%">ID Transaksi Keluar</td>
  103. <td width="2%">:</td>
  104. <td width="66%">
  105. <!-- echo $data['nim']; digunakan untuk menampilkan data dari field nim -->
  106. <input type="text" name="id_trans_klr" maxlength="15" size="9" required="" value="<?php echo $IdBaru; ?>" readonly>
  107.  
  108. </td>
  109. </tr>
  110. <tr>
  111. <td width="50%">Kode Barang</td>
  112. <td width="2%">:</td>
  113. <td width="66%">
  114. <input type="text" name="kode_brg" size="30" class="inputnonaktif" maxlength="8" required="" readonly id="kode_brg"><a href="cari_barang.php?width=400&amp;height=400" class="thickbox"><input type="submit" name="browse" id="browse3" value="Browse" /></a>
  115. *cari kode barang</tr></td>
  116.  
  117. <tr>
  118. <td width="50%">Nama Barang</td>
  119. <td width="2%">:</td>
  120. <td width="66%">
  121. <input name="nama_brg" size="30" maxlength="30" required="" readonly>
  122. </td>
  123. </tr>
  124. <!--<input type="text" name="id_daftar" size="30" class="inputnonaktif" maxlength="8" required="" readonly id="id_daftar"><a href="cari_daftar.php?width=600&height=400" class="thickbox"><input type="submit" name="browse" id="browse3" value="Browse" /></a>
  125. *cari id pendaftaran</tr></td> -->
  126. <tr>
  127. <td width="50%">Kualitas</td>
  128. <td width="2%">:</td>
  129. <td width="66%">
  130. <!-- echo $data['nama']; digunakan untuk menampilkan data dari field nama -->
  131. <input name="kualitas" size="30" maxlength="30" required="" readonly>
  132.  
  133. </td>
  134. </tr>
  135. <tr>
  136. <td width="50%">ID Suplier</td>
  137. <td width="2%">:</td>
  138. <td width="66%">
  139. <!-- echo $data['nama']; digunakan untuk menampilkan data dari field nama -->
  140. <input name="id_suplier" size="30" maxlength="30" required="" readonly>
  141.  
  142. </td>
  143. </tr>
  144. <tr>
  145. <td width="32%">Tanggal Keluar</td>
  146. <td width="2%">:</td>
  147. <td width="66%">
  148. <input type="text" name="tgl_klr" id="tanggal"/>
  149. </td>
  150. </tr>
  151. <tr>
  152. <td width="32%">Jumlah Keluar</td>
  153. <td width="2%">:</td>
  154. <td width="66%">
  155. <input name="jml_klr" size="30" maxlength="30" required="" >
  156. </td>
  157. </tr>
  158. <tr>
  159. <td width="32%">&nbsp;</td>
  160. <td width="2%">&nbsp;</td>
  161. <td width="66%">
  162. <input name="btnSimpan" type="submit" value="Simpan">
  163. <!-- membuat link ke mahasiswa_tampil.php pada tombol Batal -->
  164. <input name="btnBatal" type="reset"
  165. onclick="window.location.href='?page=barang_keluar&hal=1'" value="Batal" />
  166. </td>
  167. </tr>
  168. </table>
  169. </form>
  170.  
  171.  
  172. <?php
  173.  
  174.  
  175. //jika tombol Simpan di klik maka...
  176. if (isset($_POST['btnSimpan'])) {
  177. /*
  178. eksekusi query untuk memasukkan data pada tb_mahasiswa dengan field yang diisi
  179. nim,nama,jekel,alamat,sts_mhs
  180.  
  181. ".$_POST['txtNIM']." digunakan menampung data dari txtNIM
  182. ... dst
  183. */
  184.  
  185.  
  186.  
  187. $sql_insert = "INSERT INTO brg_klr (id_trans_klr,tgl_klr,kode_brg,nama_brg,jml_klr,id_suplier) VALUES (
  188. '".$_POST['id_trans_klr']."',
  189. '".$_POST['tgl_klr']."',
  190. '".$_POST['kode_brg']."',
  191. '".$_POST['nama_brg']."',
  192. '".$_POST['jml_klr']."',
  193. '".$_POST['id_suplier']."')";
  194. $query_insert = mysql_query($sql_insert) or die (mysql_error());
  195.  
  196. //mengcopy file gambar ke lokasi yang ditentukan [folder=imgFoto]
  197.  
  198. //jika proses penyimpanan berhasil maka...
  199. if ($query_insert) {
  200. //menampilkan pesan data berhasil disimpan
  201. echo"<script>alert('Simpan data berhasil !')</script>";
  202. //merefresh halaman ke mahasiswa_tampil.php
  203. echo "<meta http-equiv='refresh' content='0; url=?page=barang_keluar&hal=1'>";
  204. }
  205. }
  206.  
  207. }//menutup kondisi jika SES_USER tidak kosong di atas
  208.  
  209. ?>
  210.  
Please login to answer!
Selamat Malam,
Saat ini saya membuat web aplication untuk pengajuan kredit, namun saya ada kendala membuat combobox dinamis untuk jenis kredit, merk barang dan tipe barang, mohon bantuannya.
  1. <?php
  2. include("koneksi.php");
  3. ?>
  4.  
  5. <head>
  6. <title>Form Pengajuan Kredit</title>
  7. <script type="text/javascript" src="js/jqueryy.js"></script>
  8. <script type="text/javascript">
  9. var htmlobjek;
  10. $(document).ready(function() {
  11. $("#kredit").change(function() {
  12. var kredit = $("#kredit").val();
  13. $.ajax({
  14. url : "ambilmerk.php",
  15. data : "id_kredit="+id_kredit,
  16. cache : false,
  17. success : function(msg){
  18. $("#merk").html(msg);
  19. }
  20. });
  21. });
  22. $("#merk").change(function(){
  23. var merk = $("#merk").val();
  24. $.ajax({
  25. url : "ambiltipe.php",
  26. data : "id_merk="+id_merk,
  27. cache : false,
  28. success :function(msg){
  29. $("#tipe").html(msg);
  30. }
  31. });
  32. });
  33. });
  34. </script>
  35. </head>
  36.  
  37. <html>
  38. <body>
  39. <p>
  40.  
  41. <div id='header'>
  42. <div id='isi'>
  43. <form action='simpan_permohonan.php' method='post'>
  44. <fieldset>
  45. <center>
  46. <table>
  47. <tr>
  48. <td colspan='2' align='center' ><h1>Formulir Pengajuan Kredit </h1></td>
  49. </tr>
  50.  
  51. <p align='center' class='style6 style7'><img src='images/mega.jpg' class='gambar'></p>
  52.  
  53. <tr>
  54. <td>Nama Lengkap</td>
  55. <td><input type='text' name='nama' size='50' /></td>
  56. </tr>
  57.  
  58. <tr>
  59. <td>Nomor Identitas</td>
  60. <td><input type='text' name='no_id' size='50' /></td>
  61. </tr>
  62.  
  63. <tr>
  64. <td>Jenis Kelamin</td>
  65. <td><label><input type='radio' name='jenis' value='Laki Laki' />Laki-Laki</label>
  66. <label><input type='radio' name='jenis' value='Perempuan' />Perempuan</label></td>
  67. <script>
  68. var radio = document.getElementsByName('jenis');
  69. var jenis = '';
  70. for (var i = 0, length = radio.length; i < length; i++) {
  71. if (radio[i].checked) {
  72. jenis = radio[i].value;
  73. }
  74. }
  75. </script>
  76. </tr>
  77.  
  78. <tr>
  79. <td>Pekerjaan</td>
  80. <td><input type='text' name='pekerjaan' size='50' /></td>
  81. </tr>
  82.  
  83. <tr>
  84. <td>Agama</td>
  85. <td><select name='agama'>
  86. <option>Pilih Agama</option>
  87. <option>Islam</option>
  88. <option>Kristen Katolik</option>
  89. <option>Kristen Protestan</option>
  90. <option>Hindu</option>
  91. <option>Bhudha</option>
  92. <option>Kong Khuchu</option>
  93. </select>
  94. </td>
  95. </tr>
  96.  
  97. <tr>
  98. <td>Email</td>
  99. <td><input type='text' name='email' size='50' /></td>
  100. </tr>
  101.  
  102. <tr>
  103. <td>Telepon</td>
  104. <td><input type='text' name='tlp' size='50' /></td>
  105. </tr>
  106.  
  107.  
  108. <tr>
  109. <td>Alamat</td>
  110. <td><textarea name='alamat' cols='52' rows='5'> </textarea></td>
  111. </tr>
  112.  
  113. <tr>
  114. <td>Nama Perusahaan</td>
  115. <td><input type='text' name='kantor' size='50' /></td>
  116. </tr>
  117.  
  118. <tr>
  119. <td>Jabatan</td>
  120. <td><input type='text' name='jabatan' size='50' /></td>
  121. </tr>
  122.  
  123. <tr>
  124. <td>Lama Bekerja </td>
  125. <td><input type='text' name='lama_kerja' size='50' /></td>
  126. </tr>
  127.  
  128. <tr>
  129. <td>Alamat Perusahaan</td>
  130. <td><textarea name='alamat_ktr' cols='52' rows='5'> </textarea></td>
  131. </tr>
  132.  
  133. <tr>
  134. <td>Telp Perusahaan </td>
  135. <td><input type='text' name='tlp_ktr' size='50' /></td>
  136. </tr>
  137.  
  138. <tr>
  139. <td>Jenis Kredit</td>
  140. <td><select name="kredit" id="kredit" class="form-control">
  141. <option>--Pilih Jenis Kredit--</option>
  142. <?php
  143. $kredit = mysql_query("SELECT * FROM kredit ORDER BY jenis_kredit");
  144. while($p=mysql_fetch_array($kredit)){
  145. echo "<option value=\"$p[id_kredit]\">$p[jenis_kredit]</option>\n";
  146. }
  147. ?>
  148. </tr>
  149. </td>
  150. </select>
  151. <tr>
  152. <td>Merk Barang</td>
  153. <td><select name="merk" id="merk">
  154. <option>--Pilih Merk Barang--</option>
  155. <?php
  156. $kredit = mysql_query("SELECT * FROM merk ORDER BY merk_barang");
  157. while($p=mysql_fetch_array($kredit)){
  158. echo "<option value=\"$p[id_merk]\">$p[merk_barang]</option>\n";
  159. }
  160. ?>
  161. </tr>
  162. </td>
  163. </select>
  164. <tr>
  165. <td>Tipe Barang</td>
  166. <td><select name="tipe" id="tipe">
  167. <option>--Pilih Tipe Barang--</option>
  168. <?php
  169. $merk = mysql_query("SELECT * FROM tipe ORDER BY tipe_barang");
  170. while($p=mysql_fetch_array($merk)){
  171. echo "<option value=\"$p[id_tipe]\">$p[tipe_barang]</option>\n";
  172. }
  173. ?>
  174. </tr>
  175. </td>
  176. </select>
  177.  
  178. <tr>
  179. <td>Harga Barang </td>
  180. <td><input type='text' name='harga' size='25' /></td>
  181. </tr>
  182.  
  183. <tr>
  184. <td>DP </td>
  185. <td><select name='dp'>
  186. <option>Pilih Uang Muka</option>
  187. </select>
  188. </td>
  189. </tr>
  190.  
  191. <tr>
  192. <td>Tenor </td>
  193. <td><select name='tenor'>
  194. <option>Pilih Tenor</option>
  195. </select>
  196. </td>
  197. </tr>
  198.  
  199. <tr>
  200. <td>Angsuran </td>
  201. <td><select name='angsuran'>
  202. <option>Angsuran Perbulan</option>
  203. </select>
  204. </td>
  205. </tr>
  206.  
  207. <tr>
  208. <td colspan='2' align='right'><input type = 'submit' name = 'daftar' value = 'Simpan' /></td>
  209. </tr>
  210.  
  211. </table>
  212. </center>
  213. </fieldset>
  214. </form>
  215. </div>
  216. </div>
  217. </p>
  218.  
  219. </body>
  220. </html>
Please login to answer!