Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <?php
- /*
- setelah di klik.. lebih baik apa yg km klik nongol di atas jgn
- dibawah!! asd
- */
- echo"<form method=\"post\" name=\"update\">";
- echo"<table align=\"center\" border=\"1\">";
- echo"<tr bgcolor=\"iceblue\">";
- echo"<td align=\"center\"> <font face=\"calibri\" color=\"white\">";
- echo"Nama Produk</td>";
- echo"<td align=\"center\"> <font face=\"calibri\" color=\"white\">";
- echo"Qty</td>";
- echo"</tr>";
- $conn = mysql_connect("localhost","root","dancing01")or
- die(mysql_error()."Cannot connect to server");
- $data = mysql_select_db("warung",$conn)or
- die(mysql_error()."Cannot connect to database");
- $sql = "select merk_produk from master_produk";
- $result = mysql_query($sql, $conn)or
- die(mysql_error()."An error occured in SQL query <br> Query: $sql");
- while($line = mysql_fetch_row($result)){
- $merk = $line[0];
- echo"<tr bgcolor=\"iceblue\">";
- echo"<td><font face=\"calibri\" color=\"white\">";
- echo"<input type=\"checkbox\" name='produk[$merk]' value=\"$merk\" \>$merk<br>";
- echo"</td>";
- echo"<td>";
- echo"<input size=\"2%\" type=\"text\" name=\"qty\">";
- echo"</td>";
- echo"</tr>";
- }
- mysql_close($conn);
- echo"<tr bgcolor=\"iceblue\">";
- echo"<td colspan=\"2\" align=\"center\">";
- echo"<input type=\"submit\" name=\"tampil\" value=\"Tampilkan Detil Pembayaran\">";
- echo"</td>";
- echo"</tr>";
- echo"</table>";
- echo"</form>";
- if($_POST)
- {
- echo"<table align=\"center\">";
- echo"<tr bgcolor=\"iceblue\">";
- echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
- echo"No</td>";
- echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
- echo"Produk</td>";
- echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
- echo"Kategori</td>";
- echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
- echo"Harga</td>";
- echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
- echo"Stok</td>";
- echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
- echo"Qty</td>";
- echo"</tr>";
- $nomor = 0;
- foreach($_POST['produk'] as $id){
- $conn = mysql_connect("localhost","root","dancing01")or
- die(mysql_error()."Cannot connect to server");
- $data = mysql_select_db("warung", $conn)or
- die(mysql_error()."Cannot connect to database");
- $query = "select merk_produk, kategori, harga_jual, jumlah_stok from master_produk " .
- "where merk_produk = '$id' ";
- $hasil = mysql_query($query, $conn)or
- die(mysql_error()."An error occure in Query SQL <br> Query: $query");
- while($line = mysql_fetch_row($hasil)){
- $nomor++;
- $banyak = $_POST['qty'];
- $merk = $line[0];
- $kategori = $line[1];
- $harga_jual = $line[2];
- $jumlah_stok = $line[3];
- echo"<tr bgcolor=\"iceblue\">";
- echo"<td align=\"center\"><font face=\"calibri\" color=\"white\"> $nomor </td>";
- echo"<td><input type=\"text\" size=\"35%\" name=\"merk\" value=\"$merk\" disabled=\"disabled\"></td>";
- echo"<td><input type=\"text\" size=\"15%\" name=\"kategori\" value=\"$kategori\" disabled=\"disabled\"></td>";
- echo"<td><input type=\"text\" size=\"15%\" name=\"harga\" value=\"$harga_jual\"disabled=\"disabled\"></td>";
- echo"<td><input type=\"text\" size=\"2%\" name=\"stok\" value=\"$jumlah_stok\"disabled=\"disabled\"></td>";
- echo"<td><input type=\"text\" size=\"2%\" name=\"qty\" value=\"$banyak\" disabled=\"disabled\"></td>";
- echo"</tr>";
- }
- }
- echo"<tr bgcolor=\"iceblue\">";
- echo"<td colspan=\"8\" align=\"right\"><font face=\"calibri\" color=\"white\">Total Harga";
- echo"<input type=\"textbox\" name=\"total\" disabled=\"disabled\"></td>";
- echo"</tr>";
- echo"<tr bgcolor=\"iceblue\">";
- echo"<td colspan=\"8\" align=\"right\"><input type=\"submit\" name=\"bayar\" value=\"Bayar\"></td>";
- echo"</tr>";
- echo"</table>";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment