drimlen

select

May 30th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.95 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4.   <title></title>
  5. </head>
  6.  
  7. <body>
  8.  
  9. <?php
  10.  
  11.  
  12.     echo"<table align=\"center\" border=\"1\">";
  13.         echo"<tr bgcolor=\"iceblue\">";
  14.             echo"<td><font face=\"calibri\" color=\"white\">";
  15.                         $conn = mysql_connect("localhost","root","dancing01")or
  16.                             die(mysql_error()."Cannot connect to server");
  17.  
  18.                             $data = mysql_select_db("warung",$conn)or
  19.                                 die(mysql_error()."Cannot connect to database");
  20.  
  21.                                 $sql = "select merk_produk from master_produk";
  22.                                 $result = mysql_query($sql, $conn)or
  23.                                     die(mysql_error()."An error occured in SQL query <br> Query: $sql");
  24.  
  25.                                     while($line = mysql_fetch_row($result)){
  26.  
  27.                                         $merk = $line[0];
  28.  
  29.                                         echo"<input type=\"checkbox\" name=\"produk\">$merk<br>";
  30.                                     }
  31.                                 mysql_close($conn);
  32.             echo"</td>";
  33.         echo"</tr>";
  34.         echo"<tr bgcolor=\"iceblue\">";
  35.             echo"<td>";
  36.                 echo"<input type=\"submit\" name=\"tampil\" value=\"Tampilkan Detil Pembayaran\">";
  37.             echo"</td>";
  38.         echo"</tr>";
  39.     echo"</table>";
  40.  
  41. //tabel proses pembayaran
  42.  
  43.     $cek = $_GET['tampil'];
  44.     if(empty($cek))
  45.         die("Input tidak sesuai");
  46.  
  47.     echo"<table align=\"center\">";
  48.         echo"<tr bgcolor=\"iceblue\">";
  49.             echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  50.             echo"No</td>";
  51.             echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  52.             echo"Produk</td>";
  53.             echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  54.             echo"Kategori</td>";
  55.             echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  56.             echo"Harga</td>";
  57.             echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  58.             echo"Stok</td>";
  59.             echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  60.             echo"Qty</td>";
  61.         echo"</tr>";
  62.  
  63.         $nomor = 0;
  64.  
  65.         $produk = $_POST['produk'];
  66.         $query = "select merk, kategori, harga_jual, jumlah_stok from master_produk " .
  67.                 "where merk = '$produk' ";
  68.         $hasil = mysql_query($query, $conn)or
  69.             die(mysql_error()."An error occure in Query SQL <br> Query: $sql");
  70.  
  71.         while($line = mysql_fetch_row($hasil)){
  72.  
  73.         $nomor++;
  74.  
  75.         $merk = $line[0];
  76.         $kategori = $line[1];
  77.         $harga_jual = $line[2];
  78.         $jumlah_stok = $line[3];
  79.      
  80.  
  81.         echo"<tr bgcolor=\"iceblue\">";
  82.             echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  83.             echo"1</td>";
  84.             echo"<td><input type=\"text\" size=\"35%\" name=\"merk\" disabled=\"disabled\"></td>";
  85.             echo"<td><input type=\"text\" size=\"15%\" name=\"kategori\" disabled=\"disabled\"></td>";
  86.             echo"<td><input type=\"text\" size=\"15%\" name=\"harga\" disabled=\"disabled\"></td>";
  87.             echo"<td><input type=\"text\" size=\"2%\" name=\"stok\" disabled=\"disabled\"></td>";
  88.             echo"<td><input type=\"text\" size=\"2%\" name=\"qty\"></td>";
  89.         echo"</tr>";
  90.         echo"<tr bgcolor=\"iceblue\">";
  91.             echo"<td colspan=\"8\" align=\"right\"><input type=\"submit\" name=\"bayar\" value=\"Bayar\"></td>";
  92.         echo"</tr>";
  93.     echo"</table>";
  94.     }
  95. ?>
  96.  
  97. </body>
  98.  
  99. </html>
Advertisement
Add Comment
Please, Sign In to add comment