<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function pilih(){
$('select option').each(function(){
if($(this).attr('selected')==true){
$('#namapelanggan').val($(this).attr('nama'));
$('#alamat').val($(this).attr('alamat'));
}
});
}
</script>
<?php
include "koneksi.php";
$perintah="SELECT * FROM pelanggan ORDER BY kode_pelanggan";
$result=mysql_query($perintah) or die (mysql_error());
echo '<select name="kodepelanggan" onchange="pilih()">';
echo '<option>pilih kode</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['kode_pelanggan'] . '" nama ="' . $row['nama_pelanggan'] . '" alamat="' . $row['alamat'] . '">' . $row['kode_pelanggan'] . '</option>';
}
echo '</select>';
?>
<input type ="text" name="namapelanggan" id ="namapelanggan"/>
<input type ="text" name="alamat" id ="alamat"/>
ini om ellyx kode yang buat kelompok pelanggan saya buat lgi yng kelompok produk tp tidak bisa harus salah satu yang ngalah supaya produk jga bisa jalan gimn yec mas solusinya <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>FORM INPUT PO</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="javascript/jquery.js"></script>
<script type="text/javascript" src="javascript/jquery.min.js"></script>
<link type="text/css" href="development-bundle/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="development-bundle/ui.core.js"></script>
<script type="text/javascript" src="development-bundle/ui.datepicker.js"></script>
<script type="text/javascript" src="development-bundle/ui.datepicker-id.js"></script>
<script type ="text/javascript">
$(document).ready(function(){
$("#tanggal,#tgl").datepicker({
dateFormat : "dd MM yy",
changeMonth :true ,
changeYear :true
});
});
</script>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
function pilih(){
$('select option').each(function(){
if($(this).attr('selected')==true){
$('#namapelanggan').val($(this).attr('nama'));
$('#alamat').val($(this).attr('alamat'));
}
});
}
</script>
<style type="text/css">
.a {
color: #FFF;
}
.image1{
background-image: url(images/undo.png);
background-repeat: no-repeat;
width : 22px;
}
</style>
</head>
<body>
<table width="100%">
<tr>
<td colspan="9" bgcolor="#A7A7A7"><a href="pesanan1.php">Pesanan</a>
<a href="formwo.php">Work Order</a> <a href="formsj.php">Surat Jalan</a>
<a href="formfaktur.php">Faktur</a> <a href="formlap.php">Laporan</a> <a href="home.php">Log Out</a> </td>
</tr>
<tr>
<td bgcolor='#EAEAEA'>
<form name='form1' action='inputpo.php' method=post>
<table width='99%' align='center'>
<tr>
<?php
include "koneksi.php";
$result =mysql_query("select no_po from po order by no_po desc ");
$data =mysql_fetch_array($result);
if (mysql_num_rows($result)<1){
$po = 1;
}else{
$po =$data[no_po]+1;
}
?>
<td width='10%'>Tanggal PO</td>
<td colspan='2'><input type="text" name="tglpo" id="tanggal" /></td>
<td width='15%'>Kode Pelanggan</td>
<td>
<?php
include "koneksi.php";
$perintah="SELECT * FROM pelanggan ORDER BY kode_pelanggan";
$result=mysql_query($perintah) or die (mysql_error());
echo '<select name="kodepelanggan" onchange="pilih()">';
echo '<option>pilih kode</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['kode_pelanggan'] . '" nama ="' . $row['nama_pelanggan'] . '" alamat="' . $row['alamat'] . '">' . $row['kode_pelanggan'] . '</option>';
}
echo '</select>';
?>
</td>
</tr>
<tr>
<td>NO PO</td>
<td colspan='2'><input type="text" name="nopo" id="po" value =<?php echo "$po"; ?> readonly /></td>
<td>Nama Pelanggan</td>
<td><input type="text" name="namapelanggan" id="namapelanggan" readonly="readonly" /></td>
</tr>
<tr>
<td valign='top'>Tanggal Kirim</td>
<td colspan='2' valign="top"><input type="text" name="tglkirim" id="tgl" /></td>
<td valign='top'>Alamat Kirim</td>
<td><textarea name="alamat" id="alamat" cols="45" rows="3"></textarea></td>
</tr>
<td>Kode Produk</td>
<td width='10%' align='left'>
<?php
$pilih_db=mysql_select_db("penjualan") or die (mysql_error());
$perintah="SELECT * FROM produk ORDER BY kode_produk";
$jalankan_perintah=mysql_query($perintah) or die (mysql_error());
echo '<select name="kdproduk" onchange="document.getElementById(\'namaproduk\').value = nama_produk[this.value]">';
$result = mysql_query("select * from produk");
$jsArray = "var nama_produk = new Array();\n";
echo '<option>pilih kode</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['kode_produk'] . '">' . $row['kode_produk'] . '</option>';
$jsArray .= "nama_produk['" . $row['kode_produk'] . "'] = '" . addslashes($row['nama_produk']) . "';\n";
}
echo '</select>';
?>
<script type="text/javascript">
<?php echo $jsArray; ?>
</script>
</td>
<td width='12%' align='left'>Nama Produk</td>
<td align='left'><input type="text" name="namaproduk" id="namaproduk" readonly="readonly" /></td>
<td align='left'>QTY
<input type="text" name="qty" id="qty" /></td>
</tr>
<tr>
<td colspan='5' align='center' valign='top'><p>
</p>
<p>
<input type='image' name='submit' src ="images/plus.png" align="middle" title ='klik simpan data' onclick ='konfirm' />
<input type='reset' class="image1" align="middle" title ='klik undo data' onclick ='konfirm'/>
<a href='caripo.php' title ='cari data' onclick ='konfirm'><img src='images/cari.png' align="middle"/></a>
<a href='viewpo.php' title ='klik lihat data' onclick ='konfirm'><img src='images/view.png' align="middle"/></a></p></td>
</tr>
</table></form>;
<tr>
<td bgcolor="#575757"><div align="center" class="a">Created By Tatik Nur R</div></td>
</tr>
</table>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
ini om ellyx !! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>FORM INPUT PO</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="javascript/jquery.js"></script>
<script type="text/javascript" src="javascript/jquery.min.js"></script>
<link type="text/css" href="development-bundle/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="development-bundle/ui.core.js"></script>
<script type="text/javascript" src="development-bundle/ui.datepicker.js"></script>
<script type="text/javascript" src="development-bundle/ui.datepicker-id.js"></script>
<script type ="text/javascript">
$(document).ready(function(){
$("#tanggal,#tgl").datepicker({
dateFormat : "dd MM yy",
changeMonth :true ,
changeYear :true
});
});
</script>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
function pilih(){
$('#kodepelanggan option').each(function(){
if($(this).attr('selected')==true){
$('#namapelanggan').val($(this).attr('nama'));
$('#alamat').val($(this).attr('alamat'));
}
});
}
</script>
<style type="text/css">
.a {
color: #FFF;
}
.image1{
background-image: url(images/undo.png);
background-repeat: no-repeat;
width : 22px;
}
</style>
</head>
<body>
<table width="100%">
<tr>
<td colspan="9" bgcolor="#A7A7A7"><a href="pesanan1.php">Pesanan</a>
<a href="formwo.php">Work Order</a> <a href="formsj.php">Surat Jalan</a>
<a href="formfaktur.php">Faktur</a> <a href="formlap.php">Laporan</a> <a href="home.php">Log Out</a> </td>
</tr>
<tr>
<td bgcolor='#EAEAEA'>
<form name='form1' action='inputpo.php' method=post>
<table width='99%' align='center'>
<tr>
<?php
include "koneksi.php";
$result =mysql_query("select no_po from po order by no_po desc ");
$data =mysql_fetch_array($result);
if (mysql_num_rows($result)<1){
$po = 1;
}else{
$po =$data[no_po]+1;
}
?>
<td width='10%'>Tanggal PO</td>
<td colspan='2'><input type="text" name="tglpo" id="tanggal" /></td>
<td width='15%'>Kode Pelanggan</td>
<td>
<?php
include "koneksi.php";
$perintah="SELECT * FROM pelanggan ORDER BY kode_pelanggan";
$result=mysql_query($perintah) or die (mysql_error());
echo '<select name="kodepelanggan" id="kodepelanggan" onchange="pilih()">';
echo '<option>pilih kode</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['kode_pelanggan'] . '" nama ="' . $row['nama_pelanggan'] . '" alamat="' . $row['alamat'] . '">' . $row['kode_pelanggan'] . '</option>';
}
echo '</select>';
?>
</td>
</tr>
<tr>
<td>NO PO</td>
<td colspan='2'><input type="text" name="nopo" id="po" value =<?php echo "$po"; ?> readonly /></td>
<td>Nama Pelanggan</td>
<td><input type="text" name="namapelanggan" id="namapelanggan" readonly="readonly" /></td>
</tr>
<tr>
<td valign='top'>Tanggal Kirim</td>
<td colspan='2' valign="top"><input type="text" name="tglkirim" id="tgl" /></td>
<td valign='top'>Alamat Kirim</td>
<td><textarea name="alamat" id="alamat" cols="45" rows="3"></textarea></td>
</tr>
<td>Kode Produk</td>
<td width='10%' align='left'>
<?php
$pilih_db=mysql_select_db("penjualan") or die (mysql_error());
$perintah="SELECT * FROM produk ORDER BY kode_produk";
$jalankan_perintah=mysql_query($perintah) or die (mysql_error());
echo '<select name="kdproduk" onchange="document.getElementById(\'namaproduk\').value = nama_produk[this.value]">';
$result = mysql_query("select * from produk");
$jsArray = "var nama_produk = new Array();\n";
echo '<option>pilih kode</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['kode_produk'] . '">' . $row['kode_produk'] . '</option>';
$jsArray .= "nama_produk['" . $row['kode_produk'] . "'] = '" . addslashes($row['nama_produk']) . "';\n";
}
echo '</select>';
?>
<script type="text/javascript">
<?php echo $jsArray; ?>
</script>
</td>
<td width='12%' align='left'>Nama Produk</td>
<td align='left'><input type="text" name="namaproduk" id="namaproduk" readonly="readonly" /></td>
<td align='left'>QTY
<input type="text" name="qty" id="qty" /></td>
</tr>
<tr>
<td colspan='5' align='center' valign='top'><p>
</p>
<p>
<input type='image' name='submit' src ="images/plus.png" align="middle" title ='klik simpan data' onclick ='konfirm' />
<input type='reset' class="image1" align="middle" title ='klik undo data' onclick ='konfirm'/>
<a href='caripo.php' title ='cari data' onclick ='konfirm'><img src='images/cari.png' align="middle"/></a>
<a href='viewpo.php' title ='klik lihat data' onclick ='konfirm'><img src='images/view.png' align="middle"/></a></p></td>
</tr>
</table></form>;
<tr>
<td bgcolor="#575757"><div align="center" class="a">Created By Tatik Nur R</div></td>
</tr>
</table>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>