Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once("koneksi.php");
- if(isset($_POST['update'])){
- $Kode_Brg = $_POST['Kode_Brg'];
- $Deskripsi = $_POST['Deskripsi'];
- $Harga = $_POST['Harga'];
- $Disc = $_POST['Disc'];
- $Qty = $_POST['Qty'];
- $Sub_Total = $_POST['Sub_Total'];
- $No_Nota = $_POST['No_Nota'];
- if(empty($Deskripsi) || empty($Harga) || empty($Qty) || empty($Sub_Total) || empty($No_Nota)) {
- if(empty($Deskripsi)) {
- echo "<font color='red'>Deskripsi tidak boleh kosong.</font><br/>";
- }
- if(empty($Harga)) {
- echo "<font color='red'>Harga tidak boleh kosong.</font><br/>";
- }
- if(empty($Qty)) {
- echo "<font color='red'>Kwantitas tidak boleh kosong.</font><br/>";
- }
- if(empty($Sub_Total)) {
- echo "<font color='red'>Sub-Total tidak boleh kosong.</font><br/>";
- }
- if(empty($No_Nota)) {
- echo "<font color='red'>No. Nota tidak boleh kosong.</font><br/>";
- }
- } else {
- $sql="UPDATE barang
- SET
- Deskripsi='{$Deskripsi}',
- Harga='{$Harga}',
- Disc='{$Disc}',
- Qty='{$Qty}',
- Sub_Total='{$Sub_Total}',
- No_Nota='{$No_Nota}'
- WHERE
- Kode_Brg='{$Kode_Brg}'";
- $result = mysqli_query($link,$sql) or die($sql);
- header("Location: index_barang.php");
- }
- }
- $Kode_Brg = $_GET['Kode_Brg'];
- $result = mysqli_query($link,"SELECT * FROM barang WHERE Kode_Brg='{$Kode_Brg}'");
- $res = mysqli_fetch_array($result));
- $Kode_Brg = $res['Kode_Brg'];
- $Deskripsi = $res['Deskripsi'];
- $Harga = $res['Harga'];
- $Disc = $res['Disc'];
- $Qty = $res['Qty'];
- $Sub_Total = $res['Sub_Total'];
- $No_Nota = $res['No_Nota'];
- ?>
- <html>
- <head>
- <title> Data Nota dan Barang </title>
- <link rel="stylesheet" type="text/css" href="container.css">
- </head>
- <body>
- <h1><span class="blue"></span>Edit<span class="blue"></span>
- <span class="yellow">Data Barang</pan></h1>
- <h2>Created with love by <a href="www.yusufrhamadan.com" target="_blank">Yusuf Rhamadan</a></h2>
- <a href="index_barang.php" class="btInIsmynr1">Kembali</a>
- <br/><br/>
- <form name="form1" method="post" action="edit_barang.php">
- <table class="container" border="0">
- <tr>
- <td>Deskripsi</td>
- <td><input type="text" name="Deskripsi" value="<?php echo $Deskripsi;?>"></td>
- </tr>
- <tr>
- <td>Harga</td>
- <td><input type="text" name="Harga" value="<?php echo $Harga;?>"></td>
- </tr>
- <tr>
- <td>Discount</td>
- <td><input type="text" name="Disc" value="<?php echo $Disc;?>"></td>
- </tr>
- <tr>
- <td>Kwantitas</td>
- <td><input type="text" name="Qty" value="<?php echo $Qty;?>"></td>
- </tr>
- <tr>
- <td>Sub-Total</td>
- <td><input type="text" name="Sub_Total" value="<?php echo $Sub_Total;?>"></td>
- </tr>
- <tr>
- <td>No. Nota</td>
- <td><input type="text" name="No_Nota" value="<?php echo $No_Nota;?>"></td>
- </tr>
- <tr>
- <td><input type="hidden" name="Kode_Brg" value=<?php echo $Kode_Brg;?>></td>
- <td><input type="submit" name="update" value="Update"></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
Add Comment
Please, Sign In to add comment