<?php
session_start();
mysql_connect("localhost","root","") or die("Nggak bisa koneksi");
mysql_select_db("spk");//sesuaikan dengan nama database anda
$userid = $_POST['userid'];
$psw = $_POST['psw'];
$op = $_GET['op'];
if($op=="in"){
$cek = mysql_query("SELECT * FROM login WHERE nama='$userid' AND password='$psw'");
if(mysql_num_rows($cek)==1){
$c = mysql_fetch_array($cek);
$_SESSION['userid'] = $c['userid'];
$_SESSION['level'] = $c['level'];
if($c['level']=="admin"){
header("location:home.php");
}else if($c['level']=="user"){
header("location:home.php");
}
}else{
die("password salah <a href=\"javascript:history.back()\">kembali</a>");
header("location:index.php") ;
}
}else if($op=="out"){
unset($_SESSION['userid']);
unset($_SESSION['level']);
header("location:index.php");
}
?>
<?php
$page = $_GET['page']; // get the requested page
$limit = $_GET['rows']; // get how many rows we want to have into the grid
$sidx = $_GET['sidx']; // get index row - i.e. user click to sort
$sord = $_GET['sord']; // get the direction
$searchTerm = $_GET['searchTerm'];
if(!$sidx) $sidx =1;
if ($searchTerm=="") {
$searchTerm="%";
} else {
$searchTerm = "%" . $searchTerm . "%";
}
$dbhost = "localhost";
$dbuser = "root";
$dbpassword = "";
$database = "test";
// connect to the database
$db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error());
mysql_select_db($database) or die("Error conecting to db.");
$result = mysql_query("SELECT COUNT(*) AS count FROM title WHERE name like '$searchTerm'");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row['count'];
if( $count >0 ) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page - $limit; // do not put $limit*($page - 1)
if($total_pages!=0) $SQL = "SELECT * FROM title WHERE name like '$searchTerm' ORDER BY $sidx,$sord LIMIT $start , $limit";
else $SQL = "SELECT * FROM title WHERE name like '$searchTerm' ORDER BY $sidx,$sord";
$result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error());
$response->page = $page;
$response->total = $total_pages;
$response->records = $count;
$i=0;
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
/*
$response->rows[$i]['id']=$row[id];
$response->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]);
*/
$response->rows[$i]['id']=$row['id'];
$response->rows[$i]['name']=$row['name'];
$response->rows[$i]['author']=$row['author'];
//$response->rows[$i]=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]);
$i++;
}
echo json_encode($response);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ComboGrid Zero-Configuration demo</title>
<link rel="stylesheet" type="text/css" media="screen" href="resources/css/smoothness/jquery-ui-1.8.9.custom.css"/>
<link rel="stylesheet" type="text/css" media="screen" href="resources/css/smoothness/jquery.ui.combogrid.css"/>
<script type="text/javascript" src="resources/jquery/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="resources/jquery/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="resources/plugin/jquery.ui.combogrid-1.6.2.js"></script>
<script>
jQuery(document).ready(function(){
$( "#project" ).combogrid({
debug:true,
resetButton:true,
searchButton:true,
colModel: [{'columnName':'id','width':'10','label':'id'}, {'columnName':'name','width':'45','label':'title'},{'columnName':'author','width':'45','label':'author'}],
url: 'server.php',
select: function( event, ui ) {
$( "#project" ).val( ui.item.name );
return false;
}
});
});
</script>
</head>
<body>
<div>
<code>jQuery(document).ready(function(){</code><br/>
<code style="padding-left:10px;">$( "#project" ).combogrid({</code><br/>
<code style="padding-left:20px;">debug:true,</code><br/>
<code style="padding-left:20px;">searchButton:true,</code><br/>
<code style="padding-left:20px;">resetButton:true,</code><br/>
<code style="padding-left:20px;">colModel: [{'columnName':'id','width':'10','label':'id'},</code><br/>
<code style="padding-left:97px;">{'columnName':'name','width':'45','label':'title'},</code><br/>
<code style="padding-left:97px;">{'columnName':'author','width':'45','label':'author'}],<code><br/>
<code style="padding-left:20px;">url: '/server.php',</code><br/>
<code style="padding-left:20px;">//"select item" event handler to set input field</code><br/>
<code style="padding-left:20px;">select: function( event, ui ) {</code><br/>
<code style="padding-left:30px;">$( "#project" ).val( ui.item.name );</code><br/>
<code style="padding-left:30px;">return false;</code><br/>
<code style="padding-left:20px;">}</code><br/>
<code style="padding-left:10px;">});</code><br/>
<code>});</code><br/>
<p>Click on the search button to open the menu. After select an item click on the reset button to reset field.</p><br/>
<div style="float:left"><input size="30" id="project"/></div>
</div>
</body>
</html>
<?php
include('koneksi.php');
session_start();
if(!isset($_SESSION['user']) || !isset($_SESSION['passwd'])) {
?><script language='javascript'>alert('Anda belum login. Please login dulu');
document.location='login.php'</script><?php
} else {
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SPP Sekolah</title>
<link type="text/css" href="menu.css" rel="stylesheet" />
<link href="warna.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
function startCalc(){
interval = setInterval("calc()",1);
}
function calc(){
satu = document.input_spp.januari.value;
dua = document.input_spp.februari.value;
tiga = document.input_spp.maret.value;
empat = document.input_spp.april.value;
lima = document.input_spp.mei.value;
enam = document.input_spp.juni.value;
tujuh = document.input_spp.juli.value;
delapan = document.input_spp.agustus.value;
sembilan = document.input_spp.september.value;
sepuluh = document.input_spp.oktober.value;
sebelas = document.input_spp.november.value;
duabelas = document.input_spp.desember.value;
document.input_spp.total.value = (satu * 1) + (dua * 1) + (tiga * 1) + (empat * 1) + (lima * 1) + (enam * 1) + (tujuh * 1) + (delapan * 1) + (sembilan * 1) + (sepuluh * 1) + (sebelas * 1) + (duabelas * 1);
}
function stopCalc(){
clearInterval(interval);
}
</script>
<script language="javascript" type="text/javascript">
function pilih_nama()
{
//alert('test');
<?php
$n = 1;
$sql=mysql_query("SELECT * FROM siswa GROUP BY idsis ORDER BY idsis");
while ($data = mysql_fetch_array($sql))
{
$nm_siswa = $data['nm_siswa'];
echo "if (document.input_spp.nm_siswa.value == \"".$nm_siswa."\")";
echo "{";
$query2 = mysql_query("SELECT * FROM siswa WHERE nm_siswa = '$nm_siswa'");
$content1 = "document.getElementById('no_induk').innerHTML = \"";
$content0 = "document.getElementById('sekolah').innerHTML = \"";
$content = "document.getElementById('kelas').innerHTML = \"";
while ($data2 = mysql_fetch_array($query2))
{
$content1 .= "<option value='".$data2['no_induk']."'>".$data2['no_induk']."</option>";
$content0 .= "<option value='".$data2['sekolah']."'>".$data2['sekolah']."</option>";
$content .= "<option value='".$data2['kelas']."'>".$data2['kelas']."</option>";
}
$content1 .= "\";";
$content0 .= "\";";
$content .= "\";";
echo $content1;
echo $content0;
echo $content;
echo "}\n";
}
?>
}
</script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="menu.js"></script>
</head>
<br>
<style type="text/css">
* { margin:0;
padding:1;
}
body { background:rgb(74,81,85); }
div#menu { margin:5px auto; }
div#copyright {
font:11px 'Trebuchet MS';
color:#fff;
padding:40px 0 0 0;
}
div#copyright a { color:#ff4500; }
div#copyright a:hover { color:#fff; }
table#table {
font: 14px 'Trebuchet MS';
color: #fff;
border-color:#white;
}
div#putih {
font: 14px 'Trebuchet MS';
color: #fff;
}
</style>
<body>
<br />
<link type="text/css" href="back.css" rel="stylesheet" />
<div id="menu">
<ul class="menu">
<li><a href="session.php" class="parent"><span>Home</span></a></li>
<li><a href="" class="parent"><span>Master Data</span></a>
<ul>
<li><a href="frmUser.php"><span>User</span></a></li>
<li><a href="frmSiswa.php"><span>Siswa</span></a></li>
<li><a href="frmSekolah.php"><span>Sekolah</span></a></li>
</ul>
</li>
<li><a href="" class="parent"><span>Data Iuran</span></a>
<ul>
<li><a href="frmSpp.php"><span>SPP</span></a></li>
<li><a href="frmPeralatan.php"><span>Peralatan</span></a></li>
<li><a href="frmKomite.php"><span>Komite</span></a></li>
<li><a href="frmTransportasi.php"><span>Transportasi</span></a></li>
<li><a href="frmPMB.php"><span>PMB</span></a></li>
</ul>
</li>
<li><a href="" class="parent"><span>Laporan</span></a>
<ul>
<li><a href="frmLapSpp.php"><span>Laporan Spp</span></a></li>
<li><a href="frmLapPeralatan.php"><span>Laporan Iuran Peralatan</span></a></li>
<li><a href="frmLapKomite.php"><span>Laporan Iuran Komite</span></a></li>
<li><a href="frmLapTransportasi.php"><span>Laporan Iuran Transportasi</span></a></li>
<li><a href="frmLapPMB.php"><span>Laporan Iuran PMB</span></a></li>
</ul>
</li>
<li><a href="logout.php" class="parent"><span>Logout</span></a></li>
</ul>
</div>
<div align="center">
<div id="putih">
<p> </p>
<p><strong><font color="#FFFFFF" size="3">Form Data SPP Siswa</font></strong></p>
<p> </p>
<?php
if (!empty($_GET['message']) && $_GET['message'] == 'success') {
?><script language='javascript'>alert('Data Berhasil Ditambah');
document.location='frmSpp.php'</script>
<?php
}
?>
<form name="input_spp" action="insertSpp2.php" method="post">
<table border="0" cellpadding="5" cellspacing="0" >
<tbody>
<tr>
<td>Nama Siswa</td>
<td>:</td>
<td><select name="nm_siswa" id="nm_siswa" onchange="pilih_nama()">
<option value=0 selected>-- Pilih Nama --</option>
<?php
$query = mysql_query("SELECT * FROM siswa GROUP BY nm_siswa ORDER BY nm_siswa");
while ($data = mysql_fetch_array($query))
{
echo "<option value='".$data['nm_siswa']."'>".$data['nm_siswa']."</option>";
}
?>
</select></td>
<td>Juni</td>
<td>:</td>
<td><input type=text name="juni" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td>Nomor Induk</td>
<td>:</td>
<td><select id="no_induk" name="no_induk" ></select></td>
<td>Juli</td>
<td>:</td>
<td><input type=text name="juli" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td>Sekolah</td>
<td>:</td>
<td><select id="sekolah" name="sekolah"></select></td>
<td>Agustus</td>
<td>:</td>
<td><input type=text name="agustus" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td>Kelas</td>
<td>:</td>
<td><select id="kelas" name="kelas"></select></td>
<td>September</td>
<td>:</td>
<td><input type=text name="september" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td>Januari</td>
<td>:</td>
<td><input type=text name="januari" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
<td>Oktober</td>
<td>:</td>
<td><input type=text name="oktober" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td>Februari</td>
<td>:</td>
<td><input type=text name="februari" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
<td>November</td>
<td>:</td>
<td><input type=text name="november" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td>Maret</td>
<td>:</td>
<td><input type=text name="maret" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
<td>Desember</td>
<td>:</td>
<td><input type=text name="desember" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td>April</td>
<td>:</td>
<td><input type=text name="april" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
<td>Total Bayar</td>
<td>:</td>
<td><input type=text name="total" readonly="true" maxlength="100" required="required" value="<?php if(isset($_GET['total'])) echo$_GET['total']?>"/></td>
</tr>
<tr>
<td>Mei</td>
<td>:</td>
<td><input type=text name="mei" value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
<tr>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td align="right" colspan="3"><input type="submit" name="submit" value="Simpan" />
<input type="reset" name="Submit2" id="Submit2" value="Reset" /></td>
</tr>
</tbody>
</table>
</form>
<a href="frmViewSpp.php">Lihat Data</a>
<p></p>
<p> </p>
</div>
<div id="copyright" align="center">Copyright © 2012 <a href="http://apycom.com/">php</a></div>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</body>
</html>
<?php } ?>
<?php
$po= $nextNoTransaksi;
$no=1;
$sql="select * from purchase_detail where po_code = '$po'";
$query=mysql_query($sql);
while ($r=mysql_fetch_array($query)){
$id=$r['id'];
?>
<tbody>
<tr>
<td><input type="text" name="id" value="<?php echo "$id"; ?>" id="small" readonly="id"></input> </td>
<td><?php echo $r['po_code']; ?> </td>
<td style="text-transform:capitalize;"><?php echo $r['product_name']; ?></td>
<td style="text-transform:uppercase;"><?php echo $r['product_code']; ?></td>
<td style="text-transform:capitalize;"><?php echo $r['design']; ?></td>
<td><?php echo $r['description']; ?></td>
<td><input type="text" [b]name='<?php echo "price$no" ;?>'[/b] value='<?php echo $r['price']; ?>' onkeyup="grandTotal()" id="fixed" class="price" /></td>
<td style="text-align: center;">x</td>
<td><input type="text" [b]name='<?php echo "qty$no" ;?>'[/b] value='0' id="small" onkeyup="grandTotal()" class="qty"/></td>
<td align="right"><input type="text" [b]name='<?php echo "total$no" ;?>'[/b] value="0" onkeyup="grandTotal()" id="fixed" class="total" readonly='<?php echo "total$no" ;?>' /></td>
<td><a href="home.php?source=delete-cart-po&code=<?php echo $r['product_code'];?>&PONumber=<?php echo $nextNoTransaksi; ?>" onclick='return confirm("Are you sure to delete this data?");'><img src="images/icons/default/trash.png" title="Delete Data" /></a></td>
</tr>
<?php
$no++;
?>
kalau manggil misal NAME='price', kan $_post ... <?php
if($_POST) {
$nama = $_POST['nama'];
$email = $_POST['email'];
$telp = $_POST['telp'];
$berat = $_POST['berat'];
$jumlah = $_POST['jumlah'];
$tanggal = $_POST['tanggal'];
$alamat = $_POST['alamat'];
$error = array();
if(empty($nama)){
$error['nama'] = 'NAMA tidak boleh kosong';
}
if(empty($email)){
$error['email'] = 'EMAIL tidak boleh kosong';
}
if(empty($telp)){
$error['telp'] = 'No.TELP tidak boleh kosong';
}
if(empty($berat)){
$error['berat'] = 'BERAT BARANG tidak boleh kosong';
}
else if ($berat < 5 == $jumlah = 5){
$error['berat'] ='BERAT BARANG tidak sesuai';
}
if(empty($jumlah)){
$error['jumlah'] = 'JUMLAH BARANG tidak boleh kosong';
}
else if ($berat > 5 == $jumlah >= 1){
$error['jumlah'] ='JUMLAH BARANG tidak sesuai';
}
if(empty($tanggal)){
$error['tanggal'] = 'TANGGAL tidak boleh kosong';
}
if(empty($alamat)){
$error['alamat'] = 'ALAMAT tidak boleh kosong';
}
if(empty($error)){
//prosess data
}
}
?>
<form name="PickUp" method="post" action="">
<table width="75%" border="1" align="center">
<tr>
<td width="25%">NAMA</td>
<td width="50%"><div style="color:red;">
<input name="nama" id="nama" type="text" size="33" value="<?php echo isset($_POST['nama']) ? $_POST['nama'] : '';?>"/>
<?php echo isset($error['nama']) ? $error['nama'] : '';?></div>
</td>
</tr>
<tr>
<td width="15%">EMAIL</td>
<td width="35%"><div style="color:red;">
<input name="email" id="email" type="text" size="33" value="<?php echo isset($_POST['email']) ? $_POST['email'] : '';?>"/>
<?php echo isset($error['email']) ? $error['email'] : '';?></div>
</td>
</tr>
<tr>
<td width="15%">TELP</td>
<td width="35%"><div style="color:red;">
<input name="telp" id="telp" type="text" size="33" value="<?php echo isset($_POST['telp']) ? $_POST['telp'] : '';?>"/>
<?php echo isset($error['telp']) ? $error['telp'] : '';?></div>
</td>
</tr>
<tr>
<td width="15%">BERAT BARANG</td>
<td width="35%"><div style="color:red;">
<input name="berat" id="berat" type="text" size="33" value="<?php echo isset($_POST['berat']) ? $_POST['berat'] : '';?>"/>
<?php echo isset($error['berat']) ? $error['berat'] : '';?></div>
</td>
</tr> <tr>
<td width="15%">JUMLAH BARANG</td>
<td width="35%"><div style="color:red;">
<input name="jumlah" id="jumlah" type="text" size="33" value="<?php echo isset($_POST['jumlah']) ? $_POST['jumlah'] : '';?>"/>
<?php echo isset($error['jumlah']) ? $error['jumlah'] : '';?></div>
</td>
</tr>
<tr>
<td width="15%">PEMESANAN</td>
<td width="35%"><div style="color:red;">
<input name="tanggal" id="tanggal" type="text" size="33" value="<?php echo isset($_POST['tanggal']) ? $_POST['tanggal'] : '';?>"/>
<?php echo isset($error['tanggal']) ? $error['tanggal'] : '';?></div>
</td>
</tr>
<tr>
<td width="15%" valign="top">ALAMAT</td>
<td width="35%"><div style="color:red;">
<textarea name="alamat" cols="25" rows="5" id="alamat" type="text" value="<?php echo isset($_POST['alamat']) ? $_POST['alamat'] : '';?>"></textarea>
<?php echo isset($error['alamat']) ? $error['alamat'] : '';?></div>
</td>
</tr>
<tr>
<td width="15%"> </td>
<td width="35%">
<input name="submit" id="submit" type="Submit" value="PESAN" />
<input name="button" id="button" type="button" value="BATAL" onclick=self.history.back()>
</td>
</tr>
</table>
</form>
if(empty($berat)){
$error['berat'] = 'BERAT BARANG tidak boleh kosong';
}
else if ($berat < 5 == $jumlah = 5){
$error['berat'] ='BERAT BARANG tidak sesuai';
}
if(empty($jumlah)){
$error['jumlah'] = 'JUMLAH BARANG tidak boleh kosong';
}
else if ($berat > 5 == $jumlah >= 1){
$error['jumlah'] ='JUMLAH BARANG tidak sesuai';
}