|
 |
|
การตรวจสอบค่าที่เลือกของ checkbox ให้เลือกได้เพียงประเภทเดียว ทำไงดี !!! |
|
 |
|
|
 |
 |
|

จะทำอย่างไรได้บ้าง ให้เลืือกได้เพียงประเภทเดียว ติด หาคำตอบไม่ได้ ช่วยหน่อยค่ะ
Code (PHP)
<? @ob_start();?>
<? @session_start();
if (!isset($_SESSION['login_admin'])) {
header("Location:../Home.php");
exit();
}
$user = $_SESSION["login_admin"];
$Name = $_SESSION["Name"];
?>
<!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>การยกเลิกการจองเลือด</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK REL="SHORTCUT ICON" HREF="../img/Blood.gif">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="css/Strucadmin.css">
</head>
<body class="thrColFixHdr">
<div id="container">
<div id="header"></div>
<h id="menu"><? include "menuadmin.php"; ?></h>
<div id ="LA"><? include "Loginadmin.php"; ?></div>
<div id="sidebar"><? require "H5.php"; ?></div>
<p><a name="calendar" id="calendar" style="position:absolute; top:200px;"></a></p>
<div id="ca">
<h5 align="center" style="color:#333; border-bottom:inset">ปฎิทินกิจกรรม</h5>
<? include "calend.php"; ?>
</div>
<div id="sidebar">
<h5 align="center" style="color:#333; border-bottom:inset">เพื่อนบ้าน</h5>
<a href="http://medinfo.psu.ac.th/pr/pr2012/med40year/index.html"><img src="../img/h1.png" width="16" height="16" />โรงพยาบาลสงขลานครินทร์</h3></a><br>
<a href="http://www.redcross.or.th/home"><img src="../img/h1.png" width="16" height="16" />สภากาชาดไทย</h3></a>
</div>
<div id="mainContent">
<br>
<table width="730">
<tr>
<td colspan="2"><div align="center"><strong><h style="font-size:16px"><?php echo 'แบบฟอร์มการตรวจสอบการจอง'?></h></strong></div><br>
<div align="center"><strong><h style="font-size:16px">
<?
$Thday=array("อาทิตย์","จันทร์","อังคาร","พูธ","พฤหัสบดี","ศุกร์","เสาร์");
$Thmon=array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
$w=$Thday[date("w")];
$j=date("j");
$n=$Thmon[date("n")-1];
$y=date("Y")+543;
echo "ประจำวัน $w ที่ $j เดือน $n พ.ศ. $y<br>";
?></h></strong></div>
</td>
</tr>
</table><br><br>
<script language="JavaScript">
function ClickMarkAll(vol){
var i=1;
for(i=1;i<=document.frmreturn.hdnCount.value;i++){
if(vol.checked == true){
eval("document.frmreturn.chkMark"+i+".checked=true");
}
else{
eval("document.frmreturn.chkMark"+i+".checked=false");
}
}
}
function ClickCanAll(vol){
var i=1;
for(i=1;i<=document.frmreturn.hdnCount.value;i++){
if(vol.checked == true){
eval("document.frmreturn.chkCan"+i+".checked=true");
}
else{
eval("document.frmreturn.chkCan"+i+".checked=false");
}
}
}
function ClickDelAll(vol){
var i=1;
for(i=1;i<=document.frmreturn.hdnCount.value;i++){
if(vol.checked == true){
eval("document.frmreturn.chkDel"+i+".checked=true");
}
else{
eval("document.frmreturn.chkDel"+i+".checked=false");
}
}
}
function onDelete(){
if(confirm('ยืนยันการเลือก')==true){
return true;
}
else{
return false;
}
}
</script>
<form name="frmreturn" action="admin_ReturnsCH.php" method="post" OnSubmit="return onDelete();">
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("blood");
$strSQL = "SELECT * FROM receive WHERE Status ='จอง'";
mysql_query("SET NAMES UTF8");
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="730" border="1">
<tr bgcolor="#DDDDDD">
<td width="120" height="35px"><div align="center"><b>รหัสถุงเลือด</b></div></td>
<td width="80" height="35px"><div align="center"><b>หมู่เลือด</b></div></td>
<td width="120" height="35px"><div align="center"><b>วันที่จอง</b></div></td>
<td width="90" height="35px"><div align="center"><b>ชนิด</b></div></td>
<td width="150" height="35px"><div align="center"><b>ผู้จอง</b></div></td>
<td width="80" height="35px"><div align="center"><b>จองต่อ</b><br>
<input name="MarkAll" type="checkbox" id="MarkAll" value="Y" onClick="ClickMarkAll(this);"></div></td>
<td width="130"> <div align="center"><b>ยกเลิกการจอง</b><br>
<input name="CanAll" type="checkbox" id="CanAll" value="Y" onClick="ClickCanAll(this);"></div></td>
<td width="80"> <div align="center"><b>จ่ายเลือด</b><br>
<input name="DelAll" type="checkbox" id="DelAll" value="Y" onClick="ClickDelAll(this);"></div></td>
</tr>
<? $i = 0;
while($objResult = mysql_fetch_array($objQuery)){
$i++;
?>
<tr>
<td align="center"><?=$objResult["BagNumber"];?></td>
<td align="center"><?=$objResult["BloodG"];?></td>
<td align="center"><?=$objResult["Date_Bloodout"];?></td>
<td align="left"><?=$objResult["Type"];?></td>
<td align="left"><?=$objResult["receiver"];?></td>
<td align="center"><input type="checkbox" name="chkMark[]" id="chkMark<?=$i;?>" value="<?=$objResult["BagNumber"];?>"></td>
<td align="center"><input type="checkbox" name="chkCan[]" id="chkCan<?=$i;?>" value="<?=$objResult["BagNumber"];?>"></td>
<td align="center"><input type="checkbox" name="chkDel[]" id="chkDel<?=$i;?>" value="<?=$objResult["BagNumber"];?>"></td>
</tr>
<? } ?>
</table>
<? mysql_close($objConnect); ?>
<div style="margin:10px 0 10px 650px">
<input type="submit" name="btnDelete" value="บันทึกข้อมูล">
<input type="hidden" name="hdnCount" value="<?=$i;?>">
</div>
</form>
</div>
<br class="clearfloat" />
<div id="footer"></div>
</div>
</body>
</html>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2012-10-11 08:14:03 |
By :
taengii |
View :
1301 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้ Radio button แทนสิครับ
|
 |
 |
 |
 |
Date :
2012-10-11 09:13:10 |
By :
iamatomix |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
หากใช้ radio ก็ไม่สามารถเลือกทั้ง colum ได้ใช่ไหม ค่ะ
คือ มี 3 ประเภท จองต่อ ยกเลิก จ่าย
อยากทำให้สามารเลือกทั้งหมดภายใน colum ได้
แต่ใน record เลือกได้เพียงประเภทเดียว
|
 |
 |
 |
 |
Date :
2012-10-11 18:37:14 |
By :
taengii |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|