date_default_timezone_set('Asia/Jakarta');
$H_current = date('H');
$i_current = date('i');
$s_current = date('s');
$H_late = date('09');
$i_late = date('00');
$s_late = date('00');
if ($H_current > $H_late) {
$H = $H_current - $H_late;
$i = $i_current - $i_late;
$s = $s_current - $s_late;
$selwak = $H." jam ".$i." menit";
}
elseif ($H_current = $H_late) {
//$i_late = date('60');
if ($i_current > $i_late) {
$H = $H_current - $H_late;
$i = $i_current - $i_late;
$s = $s_current - $s_late;
$selwak = $H." jam ".$i." menit";
}
elseif ($i_current = $i_late){
if ($s_current > $s_late){
$H = $H_current - $H_late;
$i = $i_current - $i_late;
$s = $s_current - $s_late;
$selwak = $H." jam ".$i." menit";
}
elseif ($s_current = $s_late){
$selwak = "Tidak telat";
}
elseif ($s_current < $s_late){
$selwak = "Tidak telat";
}
}
elseif ($i_current < $i_late){
$selwak = "Tidak telat";
}
}
elseif ($H_current < $H_late) {
$selwak = "Tidak telat";
}
<?php
// Start the session
session_start();
?>
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="js/jquery.livequery.js"></script>
<link href="js/css.css" rel="stylesheet" />
<script type="text/javascript">
$cart = $(document)
$(document).ready(function() {
var Arrays=new Array();
$('#wrap li').mousemove(function(){
var position = $(this).position();
$('#cart').stop().animate({
left : position.left+'px',
},250,function(){
});
}).mouseout(function(){
});
$('#wrap li').click(function(){
var thisID = $(this).attr('id');
var itemname = $(this).find('div .name').html();
var itemprice = $(this).find('div .price').html();
if(include(Arrays,thisID))
{
var price = $('#each-'+thisID).children(".shopp-price").find('em').html();
var quantity = $('#each-'+thisID).children(".shopp-quantity").html();
quantity = parseInt(quantity)+parseInt(1);
var total = parseInt(itemprice)*parseInt(quantity);
$('#each-'+thisID).children(".shopp-price").find('em').html(total);
$('#each-'+thisID).children(".shopp-quantity").html(quantity);
var prev_charges = $('.cart-total span').html();
prev_charges = parseInt(prev_charges)-parseInt(price);
prev_charges = parseInt(prev_charges)+parseInt(total);
$('.cart-total span').html(prev_charges);
$('#total-hidden-charges').val(prev_charges);
}
else
{
Arrays.push(thisID);
var prev_charges = $('.cart-total span').html();
prev_charges = parseInt(prev_charges)+parseInt(itemprice);
$('.cart-total span').html(prev_charges);
$('#total-hidden-charges').val(prev_charges);
$('#left_bar .cart-info').append('<div class="shopp" id="each-'+thisID+'"><div class="label">'+itemname+'</div><div class="shopp-price"> $<em>'+itemprice+'</em></div><span class="shopp-quantity">1</span><img src="remove.png" class="remove" /><br class="all" /></div>');
$('#cart').css({'-webkit-transform' : 'rotate(20deg)','-moz-transform' : 'rotate(20deg)' });
}
setTimeout('angle()',200);
});
$('.remove').livequery('click', function() {
var deduct = $(this).parent().children(".shopp-price").find('em').html();
var prev_charges = $('.cart-total span').html();
var thisID = $(this).parent().attr('id').replace('each-','');
var pos = getpos(Arrays,thisID);
Arrays.splice(pos,1,"0")
prev_charges = parseInt(prev_charges)-parseInt(deduct);
$('.cart-total span').html(prev_charges);
$('#total-hidden-charges').val(prev_charges);
$(this).parent().remove();
});
$('#Submit').livequery('click', function() {
var totalCharge = $('#total-hidden-charges').val();
$('#left_bar').html('Total Charges: $'+totalCharge);
return false;
});
});
function include(arr, obj) {
for(var i=0; i<arr.length; i++) {
if (arr[i] == obj) return true;
}
}
function getpos(arr, obj) {
for(var i=0; i<arr.length; i++) {
if (arr[i] == obj) return i;
}
}
function angle(){$('#cart').css({'-webkit-transform' : 'rotate(0deg)','-moz-transform' : 'rotate(0deg)' });}
</script>
<?php $_SESSION['cart'] = $cart; ?>
<div align="left">
<table><tr><td>
<div id="wrap" align="left">
<ul>
<li id="1">
<img src="a1.png" class="items" height="100" alt="" />
<br clear="all" />
<div><span class="name">Mac/OS X: Price</span>: $<span class="price">800</span> </div>
</li>
<li id="2">
<img src="5.png" class="items" height="100" alt="" />
<br clear="all" />
<div><span class="name">IPhone 3GS </span>: $<span class="price">500 </span></div>
</li>
<li id="3">
<img src="1.png" class="items" height="100" alt="" />
<br clear="all" />
<div><span class="name">Apple IPad </span>: $<span class="price">450</span></div>
</li>
<li id="4">
<img src="6.png" class="items" height="100" alt="" />
<br clear="all" />
<div><span class="name">Mac NoteBook </span>: $<span class="price">1200 </span></div>
</li>
<li id="5">
<img src="7.png" class="items" height="100" alt="" />
<br clear="all" />
<div> <span class="name">Bag : Buy Now Price </span>: $<span class="price">65</span></div>
</li>
<li id="6">
<img src="5.png" class="items" height="100" alt="" />
<br clear="all" />
<div><span class="name">IPhone 4GS </span>: $<span class="price">800</span> </div>
</li>
<li id="7">
<img src="7.png" class="items" height="100" alt="" />
<br clear="all" />
<div><span class="name"> Bag : Buy Now Price </span>: $<span class="price">45</span></div>
</li>
<li id="8">
<img src="6.png" class="items" height="100" alt="" />
<br clear="all" />
<div><span class="name">Mac NoteBook </span>: $<span class="price">900 </span></div>
</li>
<li id="9">
<img src="8.png" class="items" height="100" alt="" />
<br clear="all" />
<div><span class="name">Sony Super Ear Phone </span>: $<span class="price">20</span></div>
</li>
</ul>
</div>
</td></tr></table>
<table><tr><td>
<div id="left_bar">
<form action="#" id="cart_form" name="cart_form">
<div class="cart-info"></div>
<div class="cart-total">
<b>Total Charges: </b> $<span>0</span>
<input type="hidden" name="total-hidden-charges" id="total-hidden-charges" value="0" />
</div>
<button type="submit" id="Submit">CheckOut</button>
</form>
</div>
</td></tr></table>
</div>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function(){
$('.price').live('keyup',function(){
var total = $(this).parent().next().next().next().find('.total');
var qty = $(this).parent().next().next().find('.qty');
$(total).val($(this).val() * $(qty).val());
});
$('.qty').live('keyup',function(){
var total = $(this).parent().next().find('.total');
var price = $(this).parent().prev().prev().find('.price');
$(total).val($(this).val() * $(price).val());
});
});
</script>
$modul = $_GET['modul'] ;
if ($modul == 'default') {
include "smp.php";
}
<?php
$marquery= mysql_query ("SELECT * FROM siswa where kelas='$kelas' and subkelas='$subkelas' order by siswa.id ASC",$jou);
if(!$marquery)
{
die ("GAGAL melakukan query terhadap siswa berdasarkan kelas dan atau subkelas: ".mysql_error());
}
while ($row=mysql_fetch_array($marquery))
{
echo "<tr><td><select name=\"kelas\" id=\"kelas\" value=\"kelas\"><option id=\"kelas\"
name=\"kelas\" value=\"".$kelas."\">".$kelas."</option></select></td><td><select
name=\"subkelas\" id=\"subkelas\" value=\"subkelas\"><option id=\"subkelas\"
name=\"subkelas\" value=\"".$subkelas."\">".$subkelas."</option></select></td><td>
<select name=\"semester\" id=\"semester\" value=\"semester\"><option id=\"semester\" name=\"semester\"
value=\"".$semester."\">".$semester."</option></select></td><td><select name=\"tahunpelajaran\"
id=\"tahunpelajaran\" value=\"tahunpelajaran\"><option id=\"tahunpelajaran\" name=\"tahunpelajaran\"
value=\"".$tahunpelajaran."\">".$tahunpelajaran."</option></select></td><td><select name=\"bidstudi\"
id=\"bidstudi\" value=\"bidstudi\"><option id=\"bidstudi\"
name=\"bidstudi\" value=\"".$bidangstudi."\">".$bidangstudi."</option></select></td>
<td><select name=\"nama_siswa\" id=\"nama_siswa\" value=\"nama_siswa\">
<option id=\"nama_siswa\" name=\"nama_siswa\" value=\"".$row['nama_siswa']."\">".$row['nama_siswa']."</option></select></td>
<td><input maxlength=\"2\" size =\"2\" type=\"text\" name=\"thk1\" id=\"thk1\" /></td>
<td><input maxlength=\"2\" size =\"2\" type=\"text\" name=\"thk2\" id=\"thk2\" /></td>
<td><input maxlength=\"2\" size =\"2\" type=\"text\" name=\"tpr1\" id=\"tpr1\" /></td>
<td><input maxlength=\"2\" size =\"2\" type=\"text\" name=\"tpr2\" id=\"tpr2\" /></td>
<td><input maxlength=\"2\" size =\"2\" type=\"text\" name=\"ub1\" id=\"ub1\" /></td>
<td><input maxlength=\"2\" size =\"2\" type=\"text\" name=\"ub2\" id=\"ub2\" /></td></tr>";
}
?>
</table>
Pastikan semua data sudah benar sebelum menyimpan. Data yang sudah disimpan TIDAK DAPAT DIRUBAH LAGI!!
<input type="submit" name="submit" id="submit" value="SIMPAN"/>
</form>
</div>
<?
?>
</div>
</body>