|
|
|
ทำไม update ได้แค่ แถวแรกแถวเดี่ยว มันไม่ยอมวนลูบให้ |
|
|
|
|
|
|
|
หน้าเป็นหน้าที่ส่งข้อมูลมา
Code (PHP)
<!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=windows-874" />
<title>Untitled Document</title>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<style>
.dpDiv {
}
.dpTable {
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: center;
color: #000000;
background-color: #c2e381;
border: 1.5px dashed #3c7b11;
}
.dpTR {
}
.dpTitleTR {
}
.dpDayTR {
}
.dpTodayButtonTR {
}
.dpTD {
border: 1px solid #c2e381;
}
.dpDayHighlightTD {
background-color: #92c655;
border: 1px solid #3c7b11;
}
.dpTDHover {
background-color: #FFFFFF;
border: 1px solid #0b6208;
cursor: pointer;
color: red;
}
.dpTitleTD {
}
.dpButtonTD {
}
.dpTodayButtonTD {
}
.dpDayTD {
background-color: #92c655;
border: 1px solid #3c7b11;
color: white;
}
.dpTitleText {
font-size: 12px;
color: #145e12;
font-weight: bold;
}
.dpDayHighlight {
color: #810e29;
font-weight: bold;
}
.dpButton {
font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #0b6208;
background: #FFFFFF;
font-weight: bold;
padding: 1px;
}
.dpTodayButton {
font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #0b6208;
background: #FFFFFF;
font-weight: bold;
}
.style1 {color: #0000FF}
</style>
</head>
<body>
<form action="update3.php" method="post" name="frm" id="frm">
<table width="900" border="0" cellspacing="5" cellpadding="0">
<tr>
<td colspan="10" align="center" bgcolor="#f49cdc" height="35"><font size="+1">แก้ไขข้อมูลผลการเรียน</font></td>
</tr>
<?php
include("../Connections/dbconn.inc.php");
for($i=0;$i<count($_POST["chkDel"]);$i++)
{
if($_POST["chkDel"][$i] != "")
{
$strSQL2 = "SELECT * FROM gpa WHERE id = '".$_POST["chkDel"][$i]."' ORDER BY id ASC";
$objQuery2 = mysql_query($strSQL2) or die ("Error Query [".$strSQL2."]");
$ii =0;
while($data = mysql_fetch_array($objQuery2))
{
$ii = $ii + 1;
?>
<tr>
<td colspan="10" align="center" bgcolor="#FFFFCC"><font size="+1">รหัสประจำตัว<span class="style1"> <?php echo $data['Studentcode']; ?></span> ชื่อ-สกุล <span class="style1"><?php echo $data['Name']; ?></span></font></td>
</tr>
<tr>
<td width="67" align="center" bgcolor="#99FFFF"><font size="-1">รหัสวิชา</font></td>
<td width="163" align="center" bgcolor="#99FFFF"><font size="-1">ชื่อวิชา</font></td>
<td width="72" align="center" bgcolor="#99FFFF"><font size="-1">หน่วยกิต</font></td>
<td width="54" align="center" bgcolor="#99FFFF"><font size="-1">คะแนน<br />
ภาคเรียนที่1</font></td>
<td width="54" align="center" bgcolor="#99FFFF"><font size="-1">คะแนน<br />
ภาคเรียนที่2</font></td>
<td width="56" align="center" bgcolor="#99FFFF"><font size="-1">เกรด</font></td>
<td width="67" align="center" bgcolor="#99FFFF"><font size="-1">ภาคเรียนที่</font></td>
<td width="91" align="center" bgcolor="#99FFFF"><font size="-1">ปีการศึกษา</font></td>
<td width="91" align="center" bgcolor="#99FFFF"><font size="-1">กลุ่มสาระ</font></td>
<td width="91" align="center" bgcolor="#99FFFF"><font size="-1">กลุ่มวิชา</font></td>
</tr>
<tr>
<td width="67" align="center" bgcolor="#CCFFFF"><font size="+1">
<input name="hdid<?=$ii;?>" type="hidden" value="<?php echo $data['id'] ?>" size="5" />
</font>
<select name="co<?=$ii;?>">
<option value="" <?php if (!(strcmp("", $data['codecourese']))) {echo "selected=\"selected\"";} ?>>-</option>
<?
$strSQL = "SELECT * FROM courses";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResult["codecourses"];?>" <?php if (!(strcmp($objResult["codecourses"], $data['codecourese']))) {echo "selected=\"selected\"";} ?>>
<?=$objResult["codecourses"];?>
</option>
<?
}
?>
</select></td>
<td width="163" align="center" bgcolor="#CCFFFF"><select name="courese<?=$ii;?>">
<option value="" <?php if (!(strcmp("", $data['courese']))) {echo "selected=\"selected\"";} ?>>-</option>
<?
$strSQL1 = "SELECT * FROM courses";
$objQuery1 = mysql_query($strSQL1) or die ("Error Query [".$strSQL1."]");
while($objResult1 = mysql_fetch_array($objQuery1))
{
?>
<option value="<?=$objResult1["courses"];?>" <?php if (!(strcmp($objResult1["courses"], $data['courese']))) {echo "selected=\"selected\"";} ?>><?=$objResult1["courses"];?></option>
<?
}
?>
</select></td>
<td width="72" align="center" bgcolor="#CCFFFF"><select name="credit<?=$ii;?>">เลือกจำนวนหน่วยกิต
<option value="" <?php if (!(strcmp("", $data['credit']))) {echo "selected=\"selected\"";} ?>>-</option>
<option value="0.5" <?php if (!(strcmp(0.5, $data['credit']))) {echo "selected=\"selected\"";} ?>>0.5</option>
<option value="1" <?php if (!(strcmp(1, $data['credit']))) {echo "selected=\"selected\"";} ?>>1</option>
<option value="1.5" <?php if (!(strcmp(1.5, $data['credit']))) {echo "selected=\"selected\"";} ?>>1.5</option>
<option value="2" <?php if (!(strcmp(2, $data['credit']))) {echo "selected=\"selected\"";} ?>>2</option>
<option value="2.5" <?php if (!(strcmp(2.5, $data['credit']))) {echo "selected=\"selected\"";} ?>>2.5</option>
<option value="3" <?php if (!(strcmp(3, $data['credit']))) {echo "selected=\"selected\"";} ?>>3</option>
<option value="3.5" <?php if (!(strcmp(3.5, $data['credit']))) {echo "selected=\"selected\"";} ?>>3.5</option>
<option value="4" <?php if (!(strcmp(4, $data['credit']))) {echo "selected=\"selected\"";} ?>>4</option>
</select></td>
<td width="54" align="center" bgcolor="#CCFFFF"><input name="score<?=$ii;?>" type="text" value="<?php echo $data['score'] ?>" size="1" /></td>
<td width="54" align="center" bgcolor="#CCFFFF"><input name="scoree<?=$ii;?>" type="text" value="<?php echo $data['scoree'] ?>" size="1" /></td>
<td width="56" align="center" bgcolor="#CCFFFF"><select name="grade<?=$ii;?>">
<option value="" <?php if (!(strcmp("", $data['grade']))) {echo "selected=\"selected\"";} ?>>-</option>
<option value="0" <?php if (!(strcmp(0, $data['grade']))) {echo "selected=\"selected\"";} ?>>0</option>
<option value="0.5" <?php if (!(strcmp(0.5, $data['grade']))) {echo "selected=\"selected\"";} ?>>0.5</option>
<option value="1" <?php if (!(strcmp(1, $data['grade']))) {echo "selected=\"selected\"";} ?>>1</option>
<option value="1.5" <?php if (!(strcmp(1.5, $data['grade']))) {echo "selected=\"selected\"";} ?>>1.5</option>
<option value="2" <?php if (!(strcmp(2, $data['grade']))) {echo "selected=\"selected\"";} ?>>2</option>
<option value="2.5" <?php if (!(strcmp(2.5, $data['grade']))) {echo "selected=\"selected\"";} ?>>2.5</option>
<option value="3" <?php if (!(strcmp(3, $data['grade']))) {echo "selected=\"selected\"";} ?>>3</option>
<option value="3.5" <?php if (!(strcmp(3.5, $data['grade']))) {echo "selected=\"selected\"";} ?>>3.5</option>
<option value="4" <?php if (!(strcmp(4, $data['grade']))) {echo "selected=\"selected\"";} ?>>4</option>
<option value="ม.ส." <?php if (!(strcmp("ม.ส.", $data['grade']))) {echo "selected=\"selected\"";} ?>>ม.ส.</option>
<option value="ผ" <?php if (!(strcmp("ผ", $data['grade']))) {echo "selected=\"selected\"";} ?>>ผ</option>
<option value="มผ." <?php if (!(strcmp("มผ.", $data['grade']))) {echo "selected=\"selected\"";} ?>>มผ.</option>
<option value="ร" <?php if (!(strcmp("ร", $data['grade']))) {echo "selected=\"selected\"";} ?>>ร</option>
</select></td>
<td width="67" align="center" bgcolor="#CCFFFF"><select name="classes<?=$ii;?>">
<option value="" <?php if (!(strcmp("", $data['classes']))) {echo "selected=\"selected\"";} ?>>-</option>
<option value="1" <?php if (!(strcmp(1, $data['classes']))) {echo "selected=\"selected\"";} ?>>1</option>
<option value="2" <?php if (!(strcmp(2, $data['classes']))) {echo "selected=\"selected\"";} ?>>2</option>
<option value="3" <?php if (!(strcmp(3, $data['classes']))) {echo "selected=\"selected\"";} ?>>3</option>
</select> </td>
<td width="91" align="center" bgcolor="#CCFFFF"><input name="year<?=$ii;?>" type="text" value="<?php echo $data['year']; ?>" size="5" /></td>
<td width="91" align="center" bgcolor="#CCFFFF"><select name="g<?=$ii;?>" >
<option value="" <?php if (!(strcmp("", $data['groupp']))) {echo "selected=\"selected\"";} ?>>-</option>
<option value="สาระการเรียนรู้พื้นฐาน" <?php if (!(strcmp("สาระการเรียนรู้พื้นฐาน", $data['groupp']))) {echo "selected=\"selected\"";} ?>>สาระการเรียนรู้พื้นฐาน</option>
<option value="สาระการเรียนรู้เพิ่มเติม" <?php if (!(strcmp("สาระการเรียนรู้เพิ่มเติม", $data['groupp']))) {echo "selected=\"selected\"";} ?>>สาระการเรียนรู้เพิ่มเติม</option>
<option value="กิจกรรมพัฒนาผู้เรียน" <?php if (!(strcmp("กิจกรรมพัฒนาผู้เรียน", $data['group']))) {echo "selected=\"selected\"";} ?>>กิจกรรมพัฒนาผู้เรียน</option>
</select></td>
<td width="91" align="center" bgcolor="#CCFFFF"><select name="c<?=$ii;?>">
<option value="" <?php if (!(strcmp("", $data['category']))) {echo "selected=\"selected\"";} ?>>-</option>
<option value="สามัญ" <?php if (!(strcmp("สามัญ", $data['category']))) {echo "selected=\"selected\"";} ?>>หมวดสามัญ</option>
<option value="ศาสนา" <?php if (!(strcmp("ศาสนา", $data['category']))) {echo "selected=\"selected\"";} ?>>หมวดศาสนา</option>
</select></td>
</tr>
<?php }}}?>
<tr>
<td colspan="10" align="center"><input type="hidden" name="hdnLine" value="<?=$ii;?>"> </td>
</tr>
<tr>
<td colspan="10" align="center"><input type="submit" name="button" id="button" value="บันทึกการแก้ไข" />
</td>
</tr>
</table>
</form>
</body>
</html>
|
|
|
|
|
Date :
2012-12-01 14:27:05 |
By :
kooyarut |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$z=$_POST["hdd"];
settype($z,int);
|
|
|
|
|
Date :
2012-12-01 15:22:33 |
By :
บิ้ง |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|