SHOW:
|
|
- or go back to the newest paste.
| 1 | <html> | |
| 2 | ||
| 3 | <head> | |
| 4 | <title></title> | |
| 5 | </head> | |
| 6 | ||
| 7 | <body> | |
| 8 | ||
| 9 | <?php | |
| 10 | /* | |
| 11 | setelah di klik.. lebih baik apa yg km klik nongol di atas jgn | |
| 12 | dibawah!! asd | |
| 13 | */ | |
| 14 | ||
| 15 | ||
| 16 | - | echo"<form method=\"post\" name=\"update\">"; |
| 16 | + | echo "<form method='post' name='update'>"; |
| 17 | - | echo"<table align=\"center\" border=\"1\">"; |
| 17 | + | echo "<table align='center' border='1'>"; |
| 18 | - | echo"<tr bgcolor=\"iceblue\">"; |
| 18 | + | echo "<tr bgcolor='iceblue'>"; |
| 19 | - | echo"<td align=\"center\"> <font face=\"calibri\" color=\"white\">"; |
| 19 | + | echo "<td align='center'> <font face='calibri' color='white'>"; |
| 20 | - | echo"Nama Produk</td>"; |
| 20 | + | echo "Nama Produk</td>"; |
| 21 | - | echo"<td align=\"center\"> <font face=\"calibri\" color=\"white\">"; |
| 21 | + | echo "<td align='center'> <font face='calibri' color='white'>"; |
| 22 | - | echo"Qty</td>"; |
| 22 | + | echo "Qty</td>"; |
| 23 | - | echo"</tr>"; |
| 23 | + | echo "</tr>"; |
| 24 | - | $conn = mysql_connect("localhost","root","dancing01")or
|
| 24 | + | $conn = mysql_connect("localhost","root","dancing01")or
|
| 25 | - | die(mysql_error()."Cannot connect to server"); |
| 25 | + | die(mysql_error()."Cannot connect to server"); |
| 26 | ||
| 27 | - | $data = mysql_select_db("warung",$conn)or
|
| 27 | + | $data = mysql_select_db("warung",$conn)or
|
| 28 | - | die(mysql_error()."Cannot connect to database"); |
| 28 | + | die(mysql_error()."Cannot connect to database"); |
| 29 | ||
| 30 | - | $sql = "select merk_produk from master_produk"; |
| 30 | + | $sql = "select merk_produk from master_produk"; |
| 31 | - | $result = mysql_query($sql, $conn)or |
| 31 | + | $result = mysql_query($sql, $conn)or |
| 32 | - | die(mysql_error()."An error occured in SQL query <br> Query: $sql"); |
| 32 | + | die(mysql_error()."An error occured in SQL query <br> Query: $sql"); |
| 33 | ||
| 34 | - | while($line = mysql_fetch_row($result)){
|
| 34 | + | while($line = mysql_fetch_row($result)){
|
| 35 | ||
| 36 | - | $merk = $line[0]; |
| 36 | + | $merk = $line[0]; |
| 37 | ||
| 38 | - | echo"<tr bgcolor=\"iceblue\">"; |
| 38 | + | echo "<tr bgcolor='iceblue'>"; |
| 39 | - | echo"<td><font face=\"calibri\" color=\"white\">"; |
| 39 | + | echo "<td><font face='calibri' color='white'>"; |
| 40 | - | echo"<input type=\"checkbox\" name='produk[$merk]' value=\"$merk\" \>$merk<br>"; |
| 40 | + | echo "<input type='checkbox' name='produk[$merk]' value='$merk' \>$merk<br>"; |
| 41 | - | echo"</td>"; |
| 41 | + | echo "</td>"; |
| 42 | - | echo"<td>"; |
| 42 | + | echo "<td>"; |
| 43 | - | echo"<input size=\"2%\" type=\"text\" name=\"qty\">"; |
| 43 | + | echo "<input size='2%' type='text' name='qty[$merk]'>"; |
| 44 | - | echo"</td>"; |
| 44 | + | echo "</td>"; |
| 45 | - | echo"</tr>"; |
| 45 | + | echo "</tr>"; |
| 46 | - | } |
| 46 | + | } |
| 47 | - | mysql_close($conn); |
| 47 | + | mysql_close($conn); |
| 48 | - | echo"<tr bgcolor=\"iceblue\">"; |
| 48 | + | echo "<tr bgcolor='iceblue'>"; |
| 49 | - | echo"<td colspan=\"2\" align=\"center\">"; |
| 49 | + | echo "<td colspan='2' align='center'>"; |
| 50 | - | echo"<input type=\"submit\" name=\"tampil\" value=\"Tampilkan Detil Pembayaran\">"; |
| 50 | + | echo "<input type='submit' name='tampil' value='Tampilkan Detil Pembayaran'>"; |
| 51 | - | echo"</td>"; |
| 51 | + | echo "</td>"; |
| 52 | - | echo"</tr>"; |
| 52 | + | echo "</tr>"; |
| 53 | - | echo"</table>"; |
| 53 | + | echo "</table>"; |
| 54 | - | echo"</form>"; |
| 54 | + | echo "</form>"; |
| 55 | ||
| 56 | - | if($_POST) |
| 56 | + | if($_POST) |
| 57 | - | {
|
| 57 | + | {
|
| 58 | ||
| 59 | - | echo"<table align=\"center\">"; |
| 59 | + | echo "<table align='center'>"; |
| 60 | - | echo"<tr bgcolor=\"iceblue\">"; |
| 60 | + | echo "<tr bgcolor='iceblue'>"; |
| 61 | - | echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">"; |
| 61 | + | echo "<td align='center'><font face='calibri' color='white'>"; |
| 62 | - | echo"No</td>"; |
| 62 | + | echo "No</td>"; |
| 63 | - | echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">"; |
| 63 | + | echo "<td align='center'><font face='calibri' color='white'>"; |
| 64 | - | echo"Produk</td>"; |
| 64 | + | echo "Produk</td>"; |
| 65 | - | echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">"; |
| 65 | + | echo "<td align='center'><font face='calibri' color='white'>"; |
| 66 | - | echo"Kategori</td>"; |
| 66 | + | echo "Kategori</td>"; |
| 67 | - | echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">"; |
| 67 | + | echo "<td align='center'><font face='calibri' color='white'>"; |
| 68 | - | echo"Harga</td>"; |
| 68 | + | echo "Harga</td>"; |
| 69 | - | echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">"; |
| 69 | + | echo "<td align='center'><font face='calibri' color='white'>"; |
| 70 | - | echo"Stok</td>"; |
| 70 | + | echo "Stok</td>"; |
| 71 | - | echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">"; |
| 71 | + | echo "<td align='center'><font face='calibri' color='white'>"; |
| 72 | - | echo"Qty</td>"; |
| 72 | + | echo "Qty</td>"; |
| 73 | - | echo"</tr>"; |
| 73 | + | echo "</tr>"; |
| 74 | ||
| 75 | $nomor = 0; | |
| 76 | ||
| 77 | ||
| 78 | - | foreach($_POST['produk'] as $id){
|
| 78 | + | foreach($_POST['produk'] as id){
|
| 79 | ||
| 80 | - | $conn = mysql_connect("localhost","root","dancing01")or
|
| 80 | + | $conn = mysql_connect("localhost","root","dancing01")or
|
| 81 | - | die(mysql_error()."Cannot connect to server"); |
| 81 | + | die(mysql_error()."Cannot connect to server"); |
| 82 | ||
| 83 | - | $data = mysql_select_db("warung", $conn)or
|
| 83 | + | $data = mysql_select_db("warung", $conn)or
|
| 84 | - | die(mysql_error()."Cannot connect to database"); |
| 84 | + | die(mysql_error()."Cannot connect to database"); |
| 85 | ||
| 86 | - | $query = "select merk_produk, kategori, harga_jual, jumlah_stok from master_produk " . |
| 86 | + | $query = "select merk_produk, kategori, harga_jual, jumlah_stok from master_produk " . |
| 87 | - | "where merk_produk = '$id' "; |
| 87 | + | "where merk_produk = '$id' "; |
| 88 | - | $hasil = mysql_query($query, $conn)or |
| 88 | + | $hasil = mysql_query($query, $conn)or |
| 89 | - | die(mysql_error()."An error occure in Query SQL <br> Query: $query"); |
| 89 | + | die(mysql_error()."An error occure in Query SQL <br> Query: $query"); |
| 90 | ||
| 91 | - | while($line = mysql_fetch_row($hasil)){
|
| 91 | + | while($line = mysql_fetch_row($hasil)){
|
| 92 | $nomor++; | |
| 93 | - | $nomor++; |
| 93 | + | |
| 94 | $banyak = $_POST['qty'][$id]; | |
| 95 | - | $banyak = $_POST['qty']; |
| 95 | + | |
| 96 | $merk = $line[0]; | |
| 97 | - | $merk = $line[0]; |
| 97 | + | $kategori = $line[1]; |
| 98 | - | $kategori = $line[1]; |
| 98 | + | $harga_jual = $line[2]; |
| 99 | - | $harga_jual = $line[2]; |
| 99 | + | $jumlah_stok = $line[3]; |
| 100 | - | $jumlah_stok = $line[3]; |
| 100 | + | |
| 101 | echo "<tr bgcolor='iceblue'>"; | |
| 102 | - | echo"<tr bgcolor=\"iceblue\">"; |
| 102 | + | echo "<td align='center'><font face='calibri' color='white'> $nomor </td>"; |
| 103 | - | echo"<td align=\"center\"><font face=\"calibri\" color=\"white\"> $nomor </td>"; |
| 103 | + | echo "<td><input type='text' size='35%' name='merk' value='$merk' disabled='disabled'></td>"; |
| 104 | - | echo"<td><input type=\"text\" size=\"35%\" name=\"merk\" value=\"$merk\" disabled=\"disabled\"></td>"; |
| 104 | + | echo "<td><input type='text' size='15%' name='kategori' value='$kategori' disabled='disabled'></td>"; |
| 105 | - | echo"<td><input type=\"text\" size=\"15%\" name=\"kategori\" value=\"$kategori\" disabled=\"disabled\"></td>"; |
| 105 | + | echo "<td><input type='text' size='15%' name='harga' value='$harga_jual'disabled='disabled'></td>"; |
| 106 | - | echo"<td><input type=\"text\" size=\"15%\" name=\"harga\" value=\"$harga_jual\"disabled=\"disabled\"></td>"; |
| 106 | + | echo "<td><input type='text' size='2%' name='stok' value='$jumlah_stok'disabled='disabled'></td>"; |
| 107 | - | echo"<td><input type=\"text\" size=\"2%\" name=\"stok\" value=\"$jumlah_stok\"disabled=\"disabled\"></td>"; |
| 107 | + | echo "<td><input type='text' size='2%' name='qty' value='$banyak' disabled='disabled'></td>"; |
| 108 | - | echo"<td><input type=\"text\" size=\"2%\" name=\"qty\" value=\"$banyak\" disabled=\"disabled\"></td>"; |
| 108 | + | echo "</tr>"; |
| 109 | - | echo"</tr>"; |
| 109 | + | |
| 110 | - | } |
| 110 | + | |
| 111 | } | |
| 112 | - | } |
| 112 | + | echo "<tr bgcolor='iceblue'>"; |
| 113 | - | echo"<tr bgcolor=\"iceblue\">"; |
| 113 | + | echo "<td colspan='8' align='right'><font face='calibri' color='white'>Total Harga"; |
| 114 | - | echo"<td colspan=\"8\" align=\"right\"><font face=\"calibri\" color=\"white\">Total Harga"; |
| 114 | + | echo "<input type='textbox' name='total' disabled='disabled'></td>"; |
| 115 | - | echo"<input type=\"textbox\" name=\"total\" disabled=\"disabled\"></td>"; |
| 115 | + | echo "</tr>"; |
| 116 | - | echo"</tr>"; |
| 116 | + | echo "<tr bgcolor='iceblue'>"; |
| 117 | - | echo"<tr bgcolor=\"iceblue\">"; |
| 117 | + | echo "<td colspan='8' align='right'><input type='submit' name='bayar' value='Bayar'></td>"; |
| 118 | - | echo"<td colspan=\"8\" align=\"right\"><input type=\"submit\" name=\"bayar\" value=\"Bayar\"></td>"; |
| 118 | + | echo "</tr>"; |
| 119 | - | echo"</tr>"; |
| 119 | + | echo "</table>"; |
| 120 | - | echo"</table>"; |
| 120 | + | } |
| 121 | ?> | |
| 122 | ||
| 123 | </body> | |
| 124 | ||
| 125 | </html> |