|
|
|
พี่คับ ถ้าต้องการจะเพิ่มคำสั่ง Insert อ่าคับ จะต้องเพิ่มตรงไหนคับ รอกวนหน่อยคับ |
|
|
|
|
|
|
|
Code (PHP)
<?
function ChkDay($myDay){
$x = 0;
if ($myDay == "Sunday"){
$x = 1;
}else if ($myDay == "Monday"){
$x = 2;
}else if ($myDay == "Tuesday"){
$x = 3;
}else if ($myDay == "Wednesday"){
$x = 4;
}else if ($myDay == "Thursday"){
$x = 5;
}else if ($myDay == "Friday"){
$x = 6;
}else if ($myDay == "Saturday"){
$x = 7;
}
return $x;
}
?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<script type="text/javascript" charset="utf-8">
function Chk1(x){
if (document.form1.Vac_VacationID1[x - 1].checked == true){
document.form1.Vac_VacationID2[x - 1].disabled = true;
document.form1.Vac_VacationID3[x - 1].disabled = true;
}else{
document.form1.Vac_VacationID2[x - 1].disabled = false;
document.form1.Vac_VacationID3[x - 1].disabled = false;
}
}
function Chk2(x){
if (document.form1.Vac_VacationID2[x - 1].checked == true){
document.form1.Vac_VacationID1[x - 1].disabled = true;
document.form1.Vac_VacationID3[x - 1].disabled = true;
}else{
document.form1.Vac_VacationID1[x - 1].disabled = false;
document.form1.Vac_VacationID3[x - 1].disabled = false;
}
}
function Chk3(x){
if (document.form1.Vac_VacationID3[x - 1].checked == true){
document.form1.Vac_VacationID2[x - 1].disabled = true;
document.form1.Vac_VacationID1[x - 1].disabled = true;
}else{
document.form1.Vac_VacationID2[x - 1].disabled = false;
document.form1.Vac_VacationID1[x - 1].disabled = false;
}
}
function mySave1(x){
alert("aaaaaaaaaaaaaaaa = " + x);
for (i=0;i<=x - 1;i++){
if (document.form1.Vac_VacationID1[i].checked){
//บันทึก
}
if (document.form1.Vac_VacationID2[i].checked){
//บันทึก
}
if (document.form1.Vac_VacationID3[i].checked){
//บันทึก
}
}
}
</script>
</head>
<body>
<input type="checkbox" name="xx1" id="xx1">
<label for="xx1">xx1</label>
<?php
// set the default timezone to use. Available since PHP 5.1
date_default_timezone_set('UTC');
// Prints something like: Monday
echo date("l");
// Prints something like: Monday 8th of August 2005 03:12:46 PM
?><br /><?
echo date('l jS \of F Y h:i:s A');
?><br /><?
// Prints: July 1, 2000 is on a Saturday
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));
?><br /><?
/* use the constants in the format parameter */
// prints something like: Mon, 15 Aug 2005 15:12:46 UTC
echo date(DATE_RFC822);
?><br /><?
// prints something like: 2000-07-01T00:00:00+00:00
echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));
?>
<br />
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 1, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 2, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 3, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 4, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 5, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 6, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 7, 2013)); ?>
<br />
<?php
$info = cal_days_in_month( CAL_GREGORIAN , 1 , 2013 ) ;
echo $info ;
?>
<?
$info = cal_days_in_month( CAL_GREGORIAN , 1, 2013 ) ;
$myDate = 1;
$x1 = 1;
$x = ChkDay(date("l", mktime(0, 0, 0, 1, 1, 2013)));
echo "x = " . $x;
echo " month = " . date("m");
?>
<form name="form1" id="form1" method="post">
<table border="1" cellspacing="1" width="90%" align="center">
<tr align="center">
<td width="15%" height="50px" bgcolor="red">อาทิตย์</td>
<td width="14%" bgcolor="gray">จันทร์</td>
<td width="14%" bgcolor="gray">อังคาร</td>
<td width="14%" bgcolor="gray">พุธ</td>
<td width="14%" bgcolor="gray">พฤหัสบดี</td>
<td width="14%" bgcolor="gray">ศุกร์</td>
<td bgcolor="red">เสาร์</td>
</tr>
<? $x1 = $x1 - $x + 1;
for($j=0;$j<7;$j++){ ?>
<tr>
<? for($i=1;$i<=7;$i++){ ?>
<td align="center" height="100px" valign="top">
<? if ($x1>0&&$x1<=$info){ ?>
<table width="100%" align="center" border="0" cellspacing="0">
<tr align="center">
<td colspan="2" height="50px"><? echo $x1; ?></td>
</tr>
<tr align="center">
<td colspan="2"><input type="checkbox" name="Vac_VacationID1" id="Vac_VacationID1" value="1" onClick="Chk1(<? echo $x1; ?>);" />เต็มวัน</td>
</tr>
<tr align="center">
<td><input type="checkbox" name="Vac_VacationID2" id="Vac_VacationID2" value="2" onClick="Chk2(<? echo $x1; ?>);" />เช้า</td>
<td><input type="checkbox" name="Vac_VacationID3" id="Vac_VacationID3" value="3" onClick="Chk3(<? echo $x1; ?>);" />บ่าย</td>
</tr>
</table>
<? } $x1++; ?>
</td>
<?}?>
</tr>
<?
if($x1>$info){
$j = 7;
}}?>
<tr align="center">
<td colspan="7"><input type="button" id="Save1" name="Save1" onClick="mySave1(<? echo $info; ?>);" value="บันทึก" />
</td>
</tr>
</table>
</form>
<? echo "day of month = " . $info; ?>
</body>
</html>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2013-01-14 15:19:47 |
By :
pongtave |
View :
726 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|