Senin, 01 Juli 2013

mohon bantuannya gan. saya punya foem penjualan. k...

Hambali Husnul Khuluk 3:00am Jul 2
mohon bantuannya gan. saya punya foem penjualan. ketika pilih brang misalnya sabun ane pengen si form barcode dan harga ngambil data dari table barang. gimana yah cara ngambil datanya. apa di atur di insert.php nya apa di tambah .php nya?
insert.php
<?php
session_start();
include "koneksii.php";

$id_barang = $_POST['id_barang'];
$id_relasi = $_POST['id_relasi'];
$tgl_beli = date('y-m-d');
$barcode = $_POST['barcode'];
$jumlah = (int)$_POST['jumlah'];
$harga_beli = (int)$_POST['harga_beli'];
$diskon = (int)$_POST['diskon'];
$total_harga = $jumlah*$harga_beli-($harga_beli*$diskon/100);
$id_user = $_SESSION['id_user'];
$query = "insert into t_pembelian values ('','$id_barang','$id_relasi','$tgl_beli','$barcode','$jumlah','$harga_beli','$diskon','$total_harga','$id_user')";
$query_jalan = mysql_query($query);
header('location:view.php');
?>

Hambali Husnul Khuluk 3:01am Jul 2
tambah.php
<form name="insert" action="insert.php" method="POST">
<article class="module width_full">
<header><h3>tambah : BANK</h3></header>
<div class="module_content">
</fieldset>
<!-- to make two field float next to one another, adjust values accordingly -->
<table>
<tr>
<td>Nama Barang</td><td>:<select name="id_barang">
<option value="0" selected>Pilih Barang</option>
<?php
include "koneksii.php";
$kotampil = mysql_query("select * from t_barang order by nama_barang");
while($baris = mysql_fetch_array($kotampil)){
$id_barang = $baris['id_barang'];
$nama_barang = $baris['nama_barang'];
?>
<option value="<?php echo $id_barang; ?>"><?php echo $nama_barang; ?></option>
<?php } ?>
</td>
</select>
</tr>
<tr>
<td>Supplier</td><td>:<select name="id_relasi">
<option value="0" selected>Pilih Supplier</option>
<?php
include "koneksii.php";
$kotampil = mysql_query("select * from tref_relasi order by nama_supplier");
while($baris = mysql_fetch_array($kotampil)){
$id_relasi = $baris['id_relasi'];
$nama_supplier = $baris['nama_supplier'];
?>
<option value="<?php echo $id_relasi; ?>"><?php echo $nama_supplier; ?></option>
<?php } ?>
</td>
</select>
</tr>

<tr>
<td>barcode</td><td>: <input type="text" style="width:80%;" name="barcode"></td>
</tr>
<tr>
<td>jumlah</td><td>: <input type="text" style="width:80%;" name="jumlah"></td>
</tr>
<tr>
<td>harga</td><td>: <input type="text" style="width:80%;" name="harga_beli"></td>
</tr>
<tr>
<td>diskon</td><td>: <input type="text" style="width:80%;" name="diskon"></td>
</tr>
<tr>
<input type="hidden" style="width:80%;" name="total_harga"></td>
</tr>


</table>
</fieldset>
</div>
</form>

Hambali Husnul Khuluk 02 Jul, 2013


-
Source: http://www.facebook.com/groups/35688476100/?id=10151730476831101
--
Manage subscription | Powered by rssforward.com

Tidak ada komentar:

Posting Komentar