ขอถามเรื่องการซ่อน div ตามเงื่อนไขด้วยครับ คือที่ค่าใน div ว่างเปล่า ให้ซ่อนเอาไว้ครับไม่ต้องแสดง แต่ถ้าค่าไม่ว่างให้แสดงครับ รบกวนด้วยนะครับ
ไม่เห็นโค้ดก็ช่วยยากครับ
Date :
2012-11-13 16:25:04
By :
sakuraei
code ยาวหน่อยนะครับครับผม ส่วน div ที่กล่าวคือ ชื่อนี้ครับ
[font=Verdana]<style type="text/css">
#show_edit{
display:'';
overflow:'hidden';
}
</style>[/font]
<?php
$colname_editdate = "1";
if (isset($_GET['historyid'])) {
$colname_editdate = (get_magic_quotes_gpc()) ? $_GET['historyid'] : addslashes($_GET['historyid']);
}
mysql_select_db($database_parttime, $parttime);
mysql_query ("SET NAMES UTF8");
$query_editdate = sprintf("SELECT * FROM history WHERE id = %s", $colname_editdate);
$editdate = mysql_query($query_editdate, $parttime) or die(mysql_error());
$row_editdate = mysql_fetch_assoc($editdate);
$totalRows_editdate = mysql_num_rows($editdate);
?>
<?php
mysql_select_db($database_parttime, $parttime);
$query_name = "SELECT parttime.name, parttime.surname FROM history LEFT JOIN parttime ON history.pt_id = parttime.id WHERE history.pt_id='".$row_editdate['pt_id']."'";
$name = mysql_query($query_name, $parttime) or die(mysql_error());
$row_name = mysql_fetch_assoc($name);
$totalRows_name = mysql_num_rows($name);
mysql_select_db($database_parttime, $parttime);
$query_edit ="SELECT *,DATE_FORMAT(startdate,'%d %b %Y') AS startdate ,DATE_FORMAT(enddate,'%d %b %Y') AS enddate FROM history WHERE id = '".$row_editdate['id']."'";
$edit = mysql_query($query_edit, $parttime) or die(mysql_error());
$row_edit = mysql_fetch_assoc($edit);
$totalRows_edit = mysql_num_rows($edit);
?>
<html>
<head>
<title>Employee details</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
.style2 {
font-family: Arial, Helvetica, sans-serif;
font-size: medium;
}
.style5 {color: #FFFFFF; font-weight: bold; }
-->
</style>
<style type="text/css">
#show_demo{
display:'none';
overflow:'hidden';
}
</style>
<style type="text/css">
#show_comment{
display:'none';
overflow:'hidden';
}
</style>
<style type="text/css">
#show_edit{
display:'';
overflow:'hidden';
}
</style>
<style type="text/css">
<!--
.style1 {color: #CCCCCC}
.style2 {font-size: x-small}
.style3 {font-family: Arial, Helvetica, sans-serif}
.style4 {font-size: small}
.style8 {font-family: Arial, Helvetica, sans-serif; font-size: x-small; }
.style9 {font-family: Arial, Helvetica, sans-serif; font-size: x-small; color: #FFFFFF; }
.style10 {color: #FFFFFF}
.style11 {color: #FFFFFF; font-size: medium; }
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<script type="text/javascript">
function KeyCode(objId)
{
if (event.keyCode >= 48 && event.keyCode<=57 || event.keyCode>=65 && event.keyCode<=90) //48-57(ตัวเลข) ,65-90(Eng ตัวพิมพ์ใหญ่ ) ,97-122(Eng ตัวพิมพ์เล็ก)
{
return true;
}
else
{
alert("กรอกได้เฉพาะตัวพิมพ์ใหญ่ A-Z และตัวเลข 0-9 เท่านั้นครับ");
return false;
}
}
</script>
<script language="JavaScript">
function setVisibility(id, visibility) {
document.getElementById(id).style.display = visibility;
}
</script>
<script language="javascript">
function fncSubmit()
{
if(document.form2.location.value != "" && document.form2.location.value.length < 5 )
{
alert('คุณกรอก Location ไม่ครบ 5 หลัก รบกวนกรอกใหม่คือ คีย์ตัวอักษรย่อ BU 3 หลัก แล้วตามด้วยตัวอักษรย่อสาขา 2 หลัก ตัวอย่างเช่น CRCHO , CDSLP เป็นต้น .');
return false;
}
document.form2.submit();
}
</script>
<div id="show_demo" display = 'visibility'>
<form action="<?php echo $editFormAction; ?>" method="POST" name="form2" onSubmit="MM_validateForm('location','','R','dept','','R','startdate','','R');return document.MM_returnValue">
<table width="90%" height="202" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="middle" bgcolor="#FF0000">
<th height="30" colspan="5" scope="col"><div align="center"></div>
<div align="center" class="style5">จองวันทำงานให้กับพนักงาน</div> <div align="center"></div> <div align="center"></div></th>
</tr>
<tr bgcolor="#333333">
<th width="11%" height="32" scope="col"> </th>
<th width="17%" align="left" scope="col"><span class="style19 style1 style4">สาขา</span></th>
<th colspan="3" align="left" scope="col"><input name="location" id="location" maxlength="5" type="text" size="5" onKeyPress="return KeyCode(location)">
<span class="style20 style1 style2 style3">ระบุตัวอักษรย่อ BU 3 หลัก แล้วตามด้วยตัวอักษรย่อสาขา 2 หลัก เช่น CRCHO </span></th>
</tr>
<tr bgcolor="#333333">
<td height="33"> </td>
<td><span class="style19 style1 style4"><strong>ี่ตำแหน่งงาน</strong></span></td>
<td width="33%">
<input name="dept" type="text" id="dept" size="30" maxlength="30" ></td>
<td colspan="2"><input type="hidden" name="user_id" id="user_id" value=<?=$objResult["user_id"];?>></td>
</tr>
<tr bgcolor="#333333">
<td height="33" bgcolor="#333333"> </td>
<td bgcolor="#333333"><span class="style19 style1 style4"><strong>จากวันที่</strong></span></td>
<td bgcolor="#333333">
<link rel="stylesheet" type="text/css" href="css/black-tie/jquery-ui-1.9.1.custom.min.css">
<script src="css/js/jquery-1.8.2.js"></script>
<script src="css/js/jquery-ui-1.9.1.custom.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<script>
$(function() {
$( "#startdate" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy'
});
});
</script>
<style type="text/css">
.ui-datepicker{
width:180px;
font-family:tahoma;
font-size:11px;
text-align:center;
}
</style>
<input type="text" name="startdate" id="startdate">
</td>
<td colspan="2" bgcolor="#333333"><input type="hidden" name="id" id="id" value=<?php echo $row_pt['id']; ?></td>
</tr>
<tr bgcolor="#333333">
<td height="34"> </td>
<td><span class="style19 style1 style4"><strong>ถึงวันที่</strong></span></td>
<td>
<link rel="stylesheet" type="text/css" href="css/black-tie/jquery-ui-1.9.1.custom.min.css">
<script src="css/js/jquery-1.8.2.js"></script>
<script src="css/js/jquery-ui-1.9.1.custom.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<script>
$(function() {
$( "#enddate" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy'
});
});
</script>
<style type="text/css">
.ui-datepicker{
width:180px;
font-family:tahoma;
font-size:11px;
text-align:center;
}
</style>
<input type="text" name="enddate" id="enddate"></td>
<td colspan="2"> </td>
</tr>
<tr bgcolor="#333333">
<td colspan="2"> </td>
<td><input type="submit" name="submit" value="ยืนยันการบันทึก"></td>
<td width="28%" colspan="2"><input type=button name=type value=' ยกเลิก ' onClick="setVisibility('show_demo', '')";></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form2">
</form>
</div>
<div id="show_comment" display = 'visibility'>
<form action="<?php echo $editFormAction; ?>" method="POST" name="form3" onSubmit="MM_validateForm('comment','','R','user_tel','','R');return document.MM_returnValue">
<table width="90%" height="198" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#333333">
<th height="30" colspan="5" bgcolor="#FF0000" class="style5" scope="col">แจ้งปัญหาหรือติชมพนักงาน</th>
</tr>
<tr bgcolor="#333333">
<th width="11%" height="32" scope="col"> </th>
<th width="17%" align="left" scope="col"><span class="style19 style1 style4">ผู้แจ้ง</span></th>
<th colspan="3" align="left" scope="col"><input name="usercomment" type="text" id="usercomment" value="คุณ<?=$objResult["user_name"];?>" size="30">
</th>
</tr>
<tr bgcolor="#333333">
<td height="33"> </td>
<td><span class="style19 style1 style4"><strong>ี่ปัญหา</strong></span></td>
<td width="33%"><input name="comment" type="text" id="comment" size="50"></td>
<td colspan="2"><input type="hidden" name="user_id" id="user_id" value=<?=$objResult["user_id"];?>></td>
</tr>
<tr bgcolor="#333333">
<td height="33" bgcolor="#333333"> </td>
<td bgcolor="#333333"><span class="style19 style1 style4"><strong>เบอร์โทร (ผู้แจ้ง) </strong></span></td>
<td bgcolor="#333333">
<input type="text" name="user_tel" id="user_tel">
</td>
<td colspan="2" bgcolor="#333333"><input type="hidden" name="id" id="id" value=<?php echo $row_pt['id']; ?>></td>
</tr>
<tr bgcolor="#333333">
<td height="34"> </td>
<td><span class="style19 style1 style4"><strong>วันที่</strong></span></td>
<td>
<link rel="stylesheet" type="text/css" href="css/black-tie/jquery-ui-1.9.1.custom.min.css">
<script src="css/js/jquery-1.8.2.js"></script>
<script src="css/js/jquery-ui-1.9.1.custom.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<script>
$(function() {
$( "#datecomment" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy'
});
});
</script>
<style type="text/css">
.ui-datepicker{
width:180px;
font-family:tahoma;
font-size:11px;
text-align:center;
}
</style>
<?
$today_date=date("d-M-Y");
?>
<input type="text" name="datecomment" id="datecomment" value=<?php echo $today_date; ?>></td>
<td colspan="2"> </td>
</tr>
<tr bgcolor="#333333">
<td colspan="2"> </td>
<td><input type="submit" name="Submit" value="ยืนยันการแจ้ง"></td>
<td width="28%" colspan="2"><input type=button name=type value=' ยกเลิก ' onClick="setVisibility('show_comment', '')";></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form3">
</form>
</div>
<link rel="stylesheet" href="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/themes/base/jquery.ui.all.css">
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/jquery-1.8.2.js"></script>
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/ui/jquery.ui.core.js"></script>
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/ui/jquery.ui.widget.js"></script>
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/ui/jquery.ui.position.js"></script>
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/ui/jquery.ui.menu.js"></script>
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/ui/jquery.ui.autocomplete.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/demos/demos.css">
<script>
$(function() {
var availableTags = [
"พนักงานขาย",
"พนักงานจัดเรียงสินค้า",
"พนักงานตรวจนับสต๊อกสินค้า",
"พนักงานห่อของขวัญ",
"พนักงานแคชเชียร์",
"พนักงานจัด Display",
"พนักงานแลกของสมนาคุณ",
"อื่นๆ (โปรดระบุ)"
];
$( "#dept" ).autocomplete({
source: availableTags
});
});
</script>
</head>
<body>
<div id="show_edit" display = ''>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#FF0000">
<th height="41" scope="col"><span class="style11">แก้ไขวันที่ทำงาน<strong>ให้กับพนักงาน</strong></span></th>
</tr>
</table>
<form action="<?php echo $editFormAction; ?>" method="POST" name="editdate" id="editdate" onClick="setVisibility('show_edit', '')";>
<table width="90%" height="202" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="middle" bgcolor="#666666">
<th height="30" colspan="5" scope="col"><div align="center"></div>
<div align="center" class="style5"></div> <div align="center"></div> <div align="center"></div></th>
</tr>
<tr bgcolor="#666666">
<th height="32" scope="col"><span class="style3">
</span></th>
<th align="left" bgcolor="#666666" scope="col"><span class="style1 style4 style19"><strong>ชื่อ</strong></span></th>
<th colspan="3" align="left" scope="col"><?php echo $row_name['name']; ?> </th>
</tr>
<tr bgcolor="#666666">
<th height="32" scope="col"> </th>
<th align="left" bgcolor="#666666" scope="col"><span class="style19 style4 style1"><strong>นามสกุล</strong></span></th>
<th colspan="3" align="left" scope="col"><?php echo $row_name['surname']; ?></th>
</tr>
<tr bgcolor="#666666">
<th width="11%" height="32" scope="col"> </th>
<th width="17%" align="left" bgcolor="#666666" scope="col"><span class="style19 style4 style1">สาขา</span></th>
<th colspan="3" align="left" scope="col"><?php echo $row_edit['location']; ?> </th>
</tr>
<tr bgcolor="#666666">
<td height="33"> </td>
<td bgcolor="#666666"><span class="style1"><span class="style19 style4 style1"><strong>ตำแหน่ง</strong></span></span></td>
<td width="33%"><input name="deptU" type="text" id="deptU" value="<?php echo $row_edit['dept']; ?>" size="30" maxlength="30" ></td>
<td colspan="2"><input type="hidden" name="user_id" id="user_id" value=<?=$objResult["user_id"];?>></td>
</tr>
<tr bgcolor="#666666">
<td height="33"> </td>
<td bgcolor="#666666"><span class="style19 style4 style1"><strong>จากวันที่</strong></span></td>
<td>
<link rel="stylesheet" type="text/css" href="css/black-tie/jquery-ui-1.9.1.custom.min.css">
<script src="css/js/jquery-1.8.2.js"></script>
<script src="css/js/jquery-ui-1.9.1.custom.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<script>
$(function() {
$( "#startdateU" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy'
});
});
</script>
<style type="text/css">
.ui-datepicker{
width:180px;
font-family:tahoma;
font-size:11px;
text-align:center;
}
</style>
<input name="startdateU" type="text" id="startdateU" value="<?php echo $row_edit['startdate']; ?>">
</td>
<td colspan="2"><input type="text" name="id" id="id" value=<?php echo $row_edit['id']; ?>>
</tr>
<tr bgcolor="#666666">
<td height="34"> </td>
<td bgcolor="#666666"><span class="style19 style4 style1"><strong>ถึงวันที่</strong></span></td>
<td>
<link rel="stylesheet" type="text/css" href="css/black-tie/jquery-ui-1.9.1.custom.min.css">
<script src="css/js/jquery-1.8.2.js"></script>
<script src="css/js/jquery-ui-1.9.1.custom.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<script>
$(function() {
$( "#enddateU" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy'
});
});
</script>
<style type="text/css">
.ui-datepicker{
width:180px;
font-family:tahoma;
font-size:11px;
text-align:center;
}
</style>
<input name="enddateU" type="text" id="enddateU" value="<?php echo $row_edit['enddate']; ?>"></td>
<td colspan="2"> </td>
</tr>
<tr bgcolor="#666666">
<td colspan="2"> </td>
<td><input type="submit" name="submit" value="ยืนยันการบันทึก"></td>
<td width="28%" colspan="2" bgcolor="#666666"><input type=button name=type value=' ยกเลิก ' onclick='show_edit()' ></td>
</tr>
<tr bgcolor="#666666">
<td colspan="2"><input name="hiddenField" type="hidden" value="<?php echo $row_name['id']; ?>"></td>
<td> </td>
<td colspan="2"> </td>
</tr>
</table>
<input type="hidden" name="MM_update" value="editdate"> </form>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#FF0000">
<th height="41" scope="col"><span class="style2">Part Time Detail </span></th>
</tr>
</table>
<p align="center">
<font color="#000033"><a href="user.php">ค้นหาใหม่</a></font></p>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#993300">
<tr>
<td width="15%" rowspan="22" align="center" bgcolor="#FF0000"><table width="59%" height="513" border="0" cellpadding="2" cellspacing="1">
<tr>
<td height="43" valign="top" class="detaillabels"><span class="style5">รูปพนักงาน</span></td>
</tr>
<tr>
<td height="191" align="center" valign="top"><img src="images/who.JPG" width="119" height="166"></td>
</tr>
<tr>
<td height="24" align="center" valign="bottom" bgcolor="#000000"><span class="style9">ลำดับที่ <?php echo $row_pt['id']; ?></span></td>
</tr>
<tr>
<td height="250" align="center" valign="bottom"><p>
<input type=button name=type value='จองวันทำงาน' onClick="setVisibility('show_demo', 'inline'),setVisibility('show_comment', '');";>
</p>
<p>
<input type=button name=type value=' แจ้งปัญหา ' onClick="setVisibility('show_comment', 'inline'),setVisibility('show_demo', '');";>
</p></td>
</tr>
</table> </td>
<td colspan="2" bgcolor="#FF0000" class="style5"><div align="center"><span class="style5">รายละเอียดพนักงาน</span></div></td>
<td bgcolor="#FF0000"> </td>
<td width="55%" colspan="3" bgcolor="#FF0000" class="style5"><div align="center">ประวัติการการทำงาน</div></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">คำนำ:</div></td>
<td width="18%" bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['title']; ?></span></td>
<td width="1%" rowspan="20" bgcolor="#FFFFFF"> </td>
<td colspan="3" rowspan="20" valign="top" bgcolor="#E0E0E0"><table width="100%" border="2" cellspacing="0" cellpadding="0">
<tr class="style8">
<th width="80" scope="col"><span class="style8">สาขา</span></th>
<th width="140" scope="col">งานที่ทำ</th>
<th width="77" scope="col"><span class="style8">จากวันที่</span></th>
<th width="77" scope="col"><span class="style8">ถึงวันที่</span></th>
<th width="70" scope="col">เกรด</th>
<th width="118" scope="col">ปุ่มคำสั่ง</th>
</tr>
<?php do { ?>
<tr bgcolor="#FFFFFF">
<td width="80" height="30"><span class="style8"><?php echo $row_history['location']; ?></span></td>
<td width="140" height="30"><span class="style8"><?php echo $row_history['dept']; ?></span></td>
<td width="77" height="30"><div align="center" class="style8"><?php echo ($row_history['startdate']); ?></div></td>
<td width="77" height="30"><div align="center" class="style8"><?php echo ($row_history['enddate']); ?></div></td>
<td width="70" height="30"><div align="center"><span class="style8"><?php echo $row_history['grade']; ?></span></div></td>
<td width="118" height="30" align="center" valign="middle"><? if($row_history['user_id']==$_SESSION['user_id']){ ?>
<div align="center"><a href="detailUPDATE.php?historyid=<?php echo $row_history['id']; ?>"><img src="images/edit.png" width="50" height="25" vspace="3" border="0" onClick="setVisibility('show_edit', 'inline');";></a><span class="style10">..</span><a href="delete.php"><img src="images/delete.png" width="50" height="24" vspace="3" border="0"></a></div>
<? } ?></td>
</tr>
<?php } while ($row_history = mysql_fetch_assoc($history)); ?>
</table></td>
</tr>
<tr>
<td width="11%" align="left" nowrap bgcolor="#E0E0E0" class="style8">ชื่อ:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['name']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">นามสกุล:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['surname']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">เพศ:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['gender']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">อายุ:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['age']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">เบอร์มือถือ:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['mobile']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">เบอร์บ้าน:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['home']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">มหาวิทยาลัย:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['university']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">คณะ์:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['kana']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">สาขา:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['major']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">ระดับการศึกษา:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['education']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">ช่วงเวลาที่สะดวก:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['time1']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8"> </td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['time2']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8"> </td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['time3']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">โซน:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['zone']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">Location 1:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['location1']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">Location 2:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['location2']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">Location 3:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['location3']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">ชั่วโมงสะสม:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['hour']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">โบนัส:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['bonus']; ?></span></td>
</tr>
<tr>
<td colspan="6" align="center" bgcolor="#FF0000"> </td>
</tr>
</table>
<table width="80%" border="0" align="center">
<tr>
<td><form name="form1" method="post" action="">
</form></td>
<td> </td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($history);
mysql_free_result($pt);
?>
Date :
2012-11-13 16:29:42
By :
sranuwat
จะซ่อนทั้งตารางเลยเหรอครับ เพราะ div show_edit คลุมตารางทั้งหมดเลยนี่ครับ
Date :
2012-11-13 16:35:23
By :
sakuraei
เปล่าครับ div show_edit จะอยู่แถวบรรทัดที่ 479-594 ครับ แต่เวลาแสดงผมให้แสดงด้านบนสุดครับ
Date :
2012-11-13 16:38:25
By :
sranuwat
เอาโค้ดมาใส่ในนี้จะดูง่ายกว่าครับ
<?php
$colname_editdate = "1";
if (isset($_GET['historyid'])) {
$colname_editdate = (get_magic_quotes_gpc()) ? $_GET['historyid'] : addslashes($_GET['historyid']);
}
mysql_select_db($database_parttime, $parttime);
mysql_query ("SET NAMES UTF8");
$query_editdate = sprintf("SELECT * FROM history WHERE id = %s", $colname_editdate);
$editdate = mysql_query($query_editdate, $parttime) or die(mysql_error());
$row_editdate = mysql_fetch_assoc($editdate);
$totalRows_editdate = mysql_num_rows($editdate);
?>
<?php
mysql_select_db($database_parttime, $parttime);
$query_name = "SELECT parttime.name, parttime.surname FROM history LEFT JOIN parttime ON history.pt_id = parttime.id WHERE history.pt_id='".$row_editdate['pt_id']."'";
$name = mysql_query($query_name, $parttime) or die(mysql_error());
$row_name = mysql_fetch_assoc($name);
$totalRows_name = mysql_num_rows($name);
mysql_select_db($database_parttime, $parttime);
$query_edit ="SELECT *,DATE_FORMAT(startdate,'%d %b %Y') AS startdate ,DATE_FORMAT(enddate,'%d %b %Y') AS enddate FROM history WHERE id = '".$row_editdate['id']."'";
$edit = mysql_query($query_edit, $parttime) or die(mysql_error());
$row_edit = mysql_fetch_assoc($edit);
$totalRows_edit = mysql_num_rows($edit);
?>
<html>
<head>
<title>Employee details</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
.style2 {
font-family: Arial, Helvetica, sans-serif;
font-size: medium;
}
.style5 {color: #FFFFFF; font-weight: bold; }
-->
</style>
<style type="text/css">
#show_demo{
display:'none';
overflow:'hidden';
}
</style>
<style type="text/css">
#show_comment{
display:'none';
overflow:'hidden';
}
</style>
<style type="text/css">
#show_edit{
display:'';
overflow:'hidden';
}
</style>
<style type="text/css">
<!--
.style1 {color: #CCCCCC}
.style2 {font-size: x-small}
.style3 {font-family: Arial, Helvetica, sans-serif}
.style4 {font-size: small}
.style8 {font-family: Arial, Helvetica, sans-serif; font-size: x-small; }
.style9 {font-family: Arial, Helvetica, sans-serif; font-size: x-small; color: #FFFFFF; }
.style10 {color: #FFFFFF}
.style11 {color: #FFFFFF; font-size: medium; }
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<script type="text/javascript">
function KeyCode(objId)
{
if (event.keyCode >= 48 && event.keyCode<=57 || event.keyCode>=65 && event.keyCode<=90) //48-57(ตัวเลข) ,65-90(Eng ตัวพิมพ์ใหญ่ ) ,97-122(Eng ตัวพิมพ์เล็ก)
{
return true;
}
else
{
alert("กรอกได้เฉพาะตัวพิมพ์ใหญ่ A-Z และตัวเลข 0-9 เท่านั้นครับ");
return false;
}
}
</script>
<script language="JavaScript">
function setVisibility(id, visibility) {
document.getElementById(id).style.display = visibility;
}
</script>
<script language="javascript">
function fncSubmit()
{
if(document.form2.location.value != "" && document.form2.location.value.length < 5 )
{
alert('คุณกรอก Location ไม่ครบ 5 หลัก รบกวนกรอกใหม่คือ คีย์ตัวอักษรย่อ BU 3 หลัก แล้วตามด้วยตัวอักษรย่อสาขา 2 หลัก ตัวอย่างเช่น CRCHO , CDSLP เป็นต้น .');
return false;
}
document.form2.submit();
}
</script>
<div id="show_demo" display = 'visibility'>
<form action="<?php echo $editFormAction; ?>" method="POST" name="form2" onSubmit="MM_validateForm('location','','R','dept','','R','startdate','','R');return document.MM_returnValue">
<table width="90%" height="202" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="middle" bgcolor="#FF0000">
<th height="30" colspan="5" scope="col"><div align="center"></div>
<div align="center" class="style5">จองวันทำงานให้กับพนักงาน</div> <div align="center"></div> <div align="center"></div></th>
</tr>
<tr bgcolor="#333333">
<th width="11%" height="32" scope="col"> </th>
<th width="17%" align="left" scope="col"><span class="style19 style1 style4">สาขา</span></th>
<th colspan="3" align="left" scope="col"><input name="location" id="location" maxlength="5" type="text" size="5" onKeyPress="return KeyCode(location)">
<span class="style20 style1 style2 style3">ระบุตัวอักษรย่อ BU 3 หลัก แล้วตามด้วยตัวอักษรย่อสาขา 2 หลัก เช่น CRCHO </span></th>
</tr>
<tr bgcolor="#333333">
<td height="33"> </td>
<td><span class="style19 style1 style4"><strong>ี่ตำแหน่งงาน</strong></span></td>
<td width="33%">
<input name="dept" type="text" id="dept" size="30" maxlength="30" ></td>
<td colspan="2"><input type="hidden" name="user_id" id="user_id" value=<?=$objResult["user_id"];?>></td>
</tr>
<tr bgcolor="#333333">
<td height="33" bgcolor="#333333"> </td>
<td bgcolor="#333333"><span class="style19 style1 style4"><strong>จากวันที่</strong></span></td>
<td bgcolor="#333333">
<link rel="stylesheet" type="text/css" href="css/black-tie/jquery-ui-1.9.1.custom.min.css">
<script src="css/js/jquery-1.8.2.js"></script>
<script src="css/js/jquery-ui-1.9.1.custom.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<script>
$(function() {
$( "#startdate" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy'
});
});
</script>
<style type="text/css">
.ui-datepicker{
width:180px;
font-family:tahoma;
font-size:11px;
text-align:center;
}
</style>
<input type="text" name="startdate" id="startdate">
</td>
<td colspan="2" bgcolor="#333333"><input type="hidden" name="id" id="id" value=<?php echo $row_pt['id']; ?></td>
</tr>
<tr bgcolor="#333333">
<td height="34"> </td>
<td><span class="style19 style1 style4"><strong>ถึงวันที่</strong></span></td>
<td>
<link rel="stylesheet" type="text/css" href="css/black-tie/jquery-ui-1.9.1.custom.min.css">
<script src="css/js/jquery-1.8.2.js"></script>
<script src="css/js/jquery-ui-1.9.1.custom.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<script>
$(function() {
$( "#enddate" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy'
});
});
</script>
<style type="text/css">
.ui-datepicker{
width:180px;
font-family:tahoma;
font-size:11px;
text-align:center;
}
</style>
<input type="text" name="enddate" id="enddate"></td>
<td colspan="2"> </td>
</tr>
<tr bgcolor="#333333">
<td colspan="2"> </td>
<td><input type="submit" name="submit" value="ยืนยันการบันทึก"></td>
<td width="28%" colspan="2"><input type=button name=type value=' ยกเลิก ' onClick="setVisibility('show_demo', '')";></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form2">
</form>
</div>
<div id="show_comment" display = 'visibility'>
<form action="<?php echo $editFormAction; ?>" method="POST" name="form3" onSubmit="MM_validateForm('comment','','R','user_tel','','R');return document.MM_returnValue">
<table width="90%" height="198" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#333333">
<th height="30" colspan="5" bgcolor="#FF0000" class="style5" scope="col">แจ้งปัญหาหรือติชมพนักงาน</th>
</tr>
<tr bgcolor="#333333">
<th width="11%" height="32" scope="col"> </th>
<th width="17%" align="left" scope="col"><span class="style19 style1 style4">ผู้แจ้ง</span></th>
<th colspan="3" align="left" scope="col"><input name="usercomment" type="text" id="usercomment" value="คุณ<?=$objResult["user_name"];?>" size="30">
</th>
</tr>
<tr bgcolor="#333333">
<td height="33"> </td>
<td><span class="style19 style1 style4"><strong>ี่ปัญหา</strong></span></td>
<td width="33%"><input name="comment" type="text" id="comment" size="50"></td>
<td colspan="2"><input type="hidden" name="user_id" id="user_id" value=<?=$objResult["user_id"];?>></td>
</tr>
<tr bgcolor="#333333">
<td height="33" bgcolor="#333333"> </td>
<td bgcolor="#333333"><span class="style19 style1 style4"><strong>เบอร์โทร (ผู้แจ้ง) </strong></span></td>
<td bgcolor="#333333">
<input type="text" name="user_tel" id="user_tel">
</td>
<td colspan="2" bgcolor="#333333"><input type="hidden" name="id" id="id" value=<?php echo $row_pt['id']; ?>></td>
</tr>
<tr bgcolor="#333333">
<td height="34"> </td>
<td><span class="style19 style1 style4"><strong>วันที่</strong></span></td>
<td>
<link rel="stylesheet" type="text/css" href="css/black-tie/jquery-ui-1.9.1.custom.min.css">
<script src="css/js/jquery-1.8.2.js"></script>
<script src="css/js/jquery-ui-1.9.1.custom.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<script>
$(function() {
$( "#datecomment" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy'
});
});
</script>
<style type="text/css">
.ui-datepicker{
width:180px;
font-family:tahoma;
font-size:11px;
text-align:center;
}
</style>
<?
$today_date=date("d-M-Y");
?>
<input type="text" name="datecomment" id="datecomment" value=<?php echo $today_date; ?>></td>
<td colspan="2"> </td>
</tr>
<tr bgcolor="#333333">
<td colspan="2"> </td>
<td><input type="submit" name="Submit" value="ยืนยันการแจ้ง"></td>
<td width="28%" colspan="2"><input type=button name=type value=' ยกเลิก ' onClick="setVisibility('show_comment', '')";></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form3">
</form>
</div>
<link rel="stylesheet" href="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/themes/base/jquery.ui.all.css">
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/jquery-1.8.2.js"></script>
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/ui/jquery.ui.core.js"></script>
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/ui/jquery.ui.widget.js"></script>
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/ui/jquery.ui.position.js"></script>
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/ui/jquery.ui.menu.js"></script>
<script src="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/ui/jquery.ui.autocomplete.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="jquery-ui-1.9.1.custom/jquery-ui-1.9.1.custom/development-bundle/demos/demos.css">
<script>
$(function() {
var availableTags = [
"พนักงานขาย",
"พนักงานจัดเรียงสินค้า",
"พนักงานตรวจนับสต๊อกสินค้า",
"พนักงานห่อของขวัญ",
"พนักงานแคชเชียร์",
"พนักงานจัด Display",
"พนักงานแลกของสมนาคุณ",
"อื่นๆ (โปรดระบุ)"
];
$( "#dept" ).autocomplete({
source: availableTags
});
});
</script>
</head>
<body>
<div id="show_edit" display = ''>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#FF0000">
<th height="41" scope="col"><span class="style11">แก้ไขวันที่ทำงาน<strong>ให้กับพนักงาน</strong></span></th>
</tr>
</table>
<form action="<?php echo $editFormAction; ?>" method="POST" name="editdate" id="editdate" onClick="setVisibility('show_edit', '')";>
<table width="90%" height="202" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="middle" bgcolor="#666666">
<th height="30" colspan="5" scope="col"><div align="center"></div>
<div align="center" class="style5"></div> <div align="center"></div> <div align="center"></div></th>
</tr>
<tr bgcolor="#666666">
<th height="32" scope="col"><span class="style3">
</span></th>
<th align="left" bgcolor="#666666" scope="col"><span class="style1 style4 style19"><strong>ชื่อ</strong></span></th>
<th colspan="3" align="left" scope="col"><?php echo $row_name['name']; ?> </th>
</tr>
<tr bgcolor="#666666">
<th height="32" scope="col"> </th>
<th align="left" bgcolor="#666666" scope="col"><span class="style19 style4 style1"><strong>นามสกุล</strong></span></th>
<th colspan="3" align="left" scope="col"><?php echo $row_name['surname']; ?></th>
</tr>
<tr bgcolor="#666666">
<th width="11%" height="32" scope="col"> </th>
<th width="17%" align="left" bgcolor="#666666" scope="col"><span class="style19 style4 style1">สาขา</span></th>
<th colspan="3" align="left" scope="col"><?php echo $row_edit['location']; ?> </th>
</tr>
<tr bgcolor="#666666">
<td height="33"> </td>
<td bgcolor="#666666"><span class="style1"><span class="style19 style4 style1"><strong>ตำแหน่ง</strong></span></span></td>
<td width="33%"><input name="deptU" type="text" id="deptU" value="<?php echo $row_edit['dept']; ?>" size="30" maxlength="30" ></td>
<td colspan="2"><input type="hidden" name="user_id" id="user_id" value=<?=$objResult["user_id"];?>></td>
</tr>
<tr bgcolor="#666666">
<td height="33"> </td>
<td bgcolor="#666666"><span class="style19 style4 style1"><strong>จากวันที่</strong></span></td>
<td>
<link rel="stylesheet" type="text/css" href="css/black-tie/jquery-ui-1.9.1.custom.min.css">
<script src="css/js/jquery-1.8.2.js"></script>
<script src="css/js/jquery-ui-1.9.1.custom.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<script>
$(function() {
$( "#startdateU" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy'
});
});
</script>
<style type="text/css">
.ui-datepicker{
width:180px;
font-family:tahoma;
font-size:11px;
text-align:center;
}
</style>
<input name="startdateU" type="text" id="startdateU" value="<?php echo $row_edit['startdate']; ?>">
</td>
<td colspan="2"><input type="text" name="id" id="id" value=<?php echo $row_edit['id']; ?>>
</tr>
<tr bgcolor="#666666">
<td height="34"> </td>
<td bgcolor="#666666"><span class="style19 style4 style1"><strong>ถึงวันที่</strong></span></td>
<td>
<link rel="stylesheet" type="text/css" href="css/black-tie/jquery-ui-1.9.1.custom.min.css">
<script src="css/js/jquery-1.8.2.js"></script>
<script src="css/js/jquery-ui-1.9.1.custom.js"></script>
<script src="development-bundle/ui/jquery.ui.datepicker.js"></script>
<script>
$(function() {
$( "#enddateU" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy'
});
});
</script>
<style type="text/css">
.ui-datepicker{
width:180px;
font-family:tahoma;
font-size:11px;
text-align:center;
}
</style>
<input name="enddateU" type="text" id="enddateU" value="<?php echo $row_edit['enddate']; ?>"></td>
<td colspan="2"> </td>
</tr>
<tr bgcolor="#666666">
<td colspan="2"> </td>
<td><input type="submit" name="submit" value="ยืนยันการบันทึก"></td>
<td width="28%" colspan="2" bgcolor="#666666"><input type=button name=type value=' ยกเลิก ' onclick='show_edit()' ></td>
</tr>
<tr bgcolor="#666666">
<td colspan="2"><input name="hiddenField" type="hidden" value="<?php echo $row_name['id']; ?>"></td>
<td> </td>
<td colspan="2"> </td>
</tr>
</table>
<input type="hidden" name="MM_update" value="editdate"> </form>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#FF0000">
<th height="41" scope="col"><span class="style2">Part Time Detail </span></th>
</tr>
</table>
<p align="center">
<font color="#000033"><a href="user.php">ค้นหาใหม่</a></font></p>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#993300">
<tr>
<td width="15%" rowspan="22" align="center" bgcolor="#FF0000"><table width="59%" height="513" border="0" cellpadding="2" cellspacing="1">
<tr>
<td height="43" valign="top" class="detaillabels"><span class="style5">รูปพนักงาน</span></td>
</tr>
<tr>
<td height="191" align="center" valign="top"><img src="images/who.JPG" width="119" height="166"></td>
</tr>
<tr>
<td height="24" align="center" valign="bottom" bgcolor="#000000"><span class="style9">ลำดับที่ <?php echo $row_pt['id']; ?></span></td>
</tr>
<tr>
<td height="250" align="center" valign="bottom"><p>
<input type=button name=type value='จองวันทำงาน' onClick="setVisibility('show_demo', 'inline'),setVisibility('show_comment', '');";>
</p>
<p>
<input type=button name=type value=' แจ้งปัญหา ' onClick="setVisibility('show_comment', 'inline'),setVisibility('show_demo', '');";>
</p></td>
</tr>
</table> </td>
<td colspan="2" bgcolor="#FF0000" class="style5"><div align="center"><span class="style5">รายละเอียดพนักงาน</span></div></td>
<td bgcolor="#FF0000"> </td>
<td width="55%" colspan="3" bgcolor="#FF0000" class="style5"><div align="center">ประวัติการการทำงาน</div></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">คำนำ:</div></td>
<td width="18%" bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['title']; ?></span></td>
<td width="1%" rowspan="20" bgcolor="#FFFFFF"> </td>
<td colspan="3" rowspan="20" valign="top" bgcolor="#E0E0E0"><table width="100%" border="2" cellspacing="0" cellpadding="0">
<tr class="style8">
<th width="80" scope="col"><span class="style8">สาขา</span></th>
<th width="140" scope="col">งานที่ทำ</th>
<th width="77" scope="col"><span class="style8">จากวันที่</span></th>
<th width="77" scope="col"><span class="style8">ถึงวันที่</span></th>
<th width="70" scope="col">เกรด</th>
<th width="118" scope="col">ปุ่มคำสั่ง</th>
</tr>
<?php do { ?>
<tr bgcolor="#FFFFFF">
<td width="80" height="30"><span class="style8"><?php echo $row_history['location']; ?></span></td>
<td width="140" height="30"><span class="style8"><?php echo $row_history['dept']; ?></span></td>
<td width="77" height="30"><div align="center" class="style8"><?php echo ($row_history['startdate']); ?></div></td>
<td width="77" height="30"><div align="center" class="style8"><?php echo ($row_history['enddate']); ?></div></td>
<td width="70" height="30"><div align="center"><span class="style8"><?php echo $row_history['grade']; ?></span></div></td>
<td width="118" height="30" align="center" valign="middle"><? if($row_history['user_id']==$_SESSION['user_id']){ ?>
<div align="center"><a href="detailUPDATE.php?historyid=<?php echo $row_history['id']; ?>"><img src="images/edit.png" width="50" height="25" vspace="3" border="0" onClick="setVisibility('show_edit', 'inline');";></a><span class="style10">..</span><a href="delete.php"><img src="images/delete.png" width="50" height="24" vspace="3" border="0"></a></div>
<? } ?></td>
</tr>
<?php } while ($row_history = mysql_fetch_assoc($history)); ?>
</table></td>
</tr>
<tr>
<td width="11%" align="left" nowrap bgcolor="#E0E0E0" class="style8">ชื่อ:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['name']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">นามสกุล:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['surname']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">เพศ:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['gender']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">อายุ:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['age']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">เบอร์มือถือ:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['mobile']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">เบอร์บ้าน:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['home']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">มหาวิทยาลัย:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['university']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">คณะ์:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['kana']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">สาขา:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['major']; ?></span></td>
</tr>
<tr>
<td align="left" nowrap bgcolor="#E0E0E0" class="style8">ระดับการศึกษา:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['education']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">ช่วงเวลาที่สะดวก:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['time1']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8"> </td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['time2']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8"> </td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['time3']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">โซน:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['zone']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">Location 1:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['location1']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">Location 2:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['location2']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">Location 3:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['location3']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">ชั่วโมงสะสม:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['hour']; ?></span></td>
</tr>
<tr>
<td nowrap bgcolor="#E0E0E0" class="style8">โบนัส:</td>
<td bgcolor="#E0E0E0" class="style8"><span class="style8"><?php echo $row_pt['bonus']; ?></span></td>
</tr>
<tr>
<td colspan="6" align="center" bgcolor="#FF0000"> </td>
</tr>
</table>
<table width="80%" border="0" align="center">
<tr>
<td><form name="form1" method="post" action="">
</form></td>
<td> </td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($history);
mysql_free_result($pt);
?>
Date :
2012-11-13 16:41:47
By :
sakuraei
385.<script>
386.$(function() {
387.$( "#startdateU" ).datepicker({
388.changeMonth: true,
389.changeYear: true,
390.dateFormat: 'dd M yy'
391.});
if("<?php echo $row_edit['id']; ?>" == "")
$("div#show_edit").hide();
392.});
Date :
2012-11-13 16:51:03
By :
sakuraei
ได้แล้วครับ ขอบคุณ คุณ Unidentifier มากเลยครับ
แต่ผมขอถามต่อนิดหนึ่ง หลังจากที่ผม แก้ไขข้อมูลแล้ว กดปุ่มยืนยัน ต้องการให้มันซ่อนต่อครับ ตอนนี้มันโชว์ตลอดเลยครับ
รบกวนอีกครั้งนะครับ
Date :
2012-11-13 17:12:20
By :
sranuwat
<input type="submit" name="submit" value="ยืนยันการบันทึก"> กดปุ่มนี้แล้วหน้าจอเปลี่ยนไปหรือเปล่าครับบ หรือยังคงอยู่หน้าเดิม แล้วข้อมูลที่กรอกไว้ในหน้านี้ หลังจากการกดปุ่มยังคงอยู่มั๊ย
Date :
2012-11-13 17:23:08
By :
sakuraei
หลังจากกดปุ่มแล้ว หน้าจออยู่หน้าเดิมแต่ข้อมูลด้านล่างถูก UPDATE ตามที่เรากรอกครับครับ และข้อมูลที่เราเปลี่ยนตรง div ยังคงอยู่ด้วยครับ
Date :
2012-11-13 17:29:59
By :
sranuwat
385.<script>
386.$(function() {
387.$( "#startdateU" ).datepicker({
388.changeMonth: true,
389.changeYear: true,
390.dateFormat: 'dd M yy'
391.});
if("<?php echo $row_edit['id']; ?>" == "")
$("div#show_edit").hide();
$("input[type='submit']").click(function(event){
$("div#show_edit").hide();
});
392.});
Date :
2012-11-13 17:38:45
By :
sakuraei
ผมเปลี่ยนแล้ว ยังไม่หายครับ รบกวนด้วยครับ
<script>
$(function() {
$( "#startdateU" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy'
});
if("<?php echo $row_edit['id']; ?>" == "")
$("div#show_edit").hide();
$("input[type='submit']").click(function(event){
$("div#show_edit").hide();
});
});
</script>
Date :
2012-11-13 17:49:41
By :
sranuwat
คลิกขวาแล้ว view source มาให้ดูหน่อยครับ ผมอยากเห็นบรรทัดนี้ครับ
<form action="<?php echo $editFormAction; ?>" method="POST" name="form2"
Date :
2012-11-13 17:54:15
By :
sakuraei
มาแล้วครับ
<form action="/parttime/detailUPDATE.php?historyid=5" method="POST" name="editdate" id="editdate" onClick="setVisibility('show_edit', '')";>
Date :
2012-11-13 17:57:26
By :
sranuwat
โค้ดทั้งหมดที่เอาวางให้ดูตั้งแต่แรก เป็นไฟล์ detailUPDATE.php หรือป่าวครับ
Date :
2012-11-13 18:00:17
By :
sakuraei
ใช่ครับ แต่ Code ตอนยังไม่ run จะเป็นแบบบี้ครับ
<form action="<?php echo $editFormAction; ?>" method="POST" name="editdate" id="editdate" onClick="setVisibility('show_edit', '')";>
Date :
2012-11-13 18:09:27
By :
sranuwat
การกดปุ่ม submit จะทำให้หน้าจอมัน refresh ครับ เพราะฉะนั้นถึงแม้ว่าเราซ่อน div ไว้แล้ว หลังจากที่มันโหลดหน้าขึ้นมาใหม่ div ก็จะกลับมาแสดงเป็นปกติครับ
เราต้องแก้โดยการป้องกัน การซับมิท และทำการส่งข้อมูลเองด้วย jquery อาจเป็น $.post หรือ $.get ก็แล้วแต่
Date :
2012-11-13 18:12:30
By :
sakuraei
ทำไงดีครับ จากคำที่พี่แนะนำ ผมไปต่อไม่ได้ครับ ช่วยผมด้วยนะครับ
Date :
2012-11-13 18:18:53
By :
sranuwat
Load balance : Server 04