|
|
|
ช่วยดูโค๊ดนี่ให้หน่อยค่ะ...<? session_start(); if ($_SESSION["username"] == ""){ header("location:index.php"); |
|
|
|
|
|
|
|
Code (PHP)
<?php
<?
session_start();
if ($_SESSION["username"] == ""){
header("location:index.php");
} ?>
<html><title>โรงเรียนองค์การบริหารส่วนตำบลทรายขาว (ท่าฮ่อ) อ.พาน จ.เชียงราย </title></html>
<script language="javascript">
function digitsOnlyYouKnow(sensor){
var regexp = /[0-9-]$/;
if(!regexp.test(sensor.value)){
alert('กรุณากรอกเป็นตัวเลข');
}
}
</script>
<body>
<? include ('connect.php');
include('fucntion.php');
head1($head1);
?><br>
<center>
</center>
<form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="599" border="1" align="center">
<tr>
<td ><center>
<font color="red" size="-1">**กรอกรหัสนักเรียน</font>
<input name="id_s" type="text" id="id_s"/ onKeyUp="javascript:digitsOnlyYouKnow(this);">
<input type="submit" value="ค้นหา"></center></td>
</tr>
</table>
</form>
<form id="formgrade" name="formgrade" onSubmit="JavaScript:return fncSubmit();" method="post" action="savegrade">
<table align="center">
<tr>
<td width="150"><center>ภาคเรียนที่
<input name="semester_r" type="radio" value="1" /> 1</label>
<input name="semester_r" type="radio" value="2" /> 2 </label> </center></td>
<td width="150"><center>ปีการศึกษา <input name="academicyear_r" type="text" id="academicyear_r" size="5" maxlength="5" onKeyUp="javascript:digitsOnlyYouKnow(this);"> </center> </td>
<td width="150"> <center>ชื่อวิชา<select name="name_v" id="name_v">
<option value="">วิชา</option>
<? $objDB = mysql_select_db("rigister");
$strSQL = "SELECT name FROM vichar";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($rs=mysql_fetch_array($objQuery)) {?>
<option value=<?=$rs["name"];?>> <?= $rs["name"] ?> </option> <? } ?>
</select> </center></td>
</table><br>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#000000" align="center">
<tr bordercolor="#333333" bgcolor="#FFFFFF">
<td width="90" height="26"> <div align="center"><font size="3" face="AngsanaUPC, BrowalliaUPC, CordiaUPC"><strong>รหัสนักศึกษา</strong></font></div></td>
<td width="200"><div align="center"><font size="3" face="AngsanaUPC, BrowalliaUPC, CordiaUPC"><strong>ชื่อ
สกุล </strong></font></div></td>
<td width="70"><div align="center"><font size="3" face="AngsanaUPC, BrowalliaUPC, CordiaUPC"><strong>คะแนนกลางภาค</strong></font></div></td>
<td width="70"><div align="center"><font size="3" face="AngsanaUPC, BrowalliaUPC, CordiaUPC"><strong>คะแนนปลายภาค</strong></font></div></td>
<td width="40"><div align="center"><font size="3" face="AngsanaUPC, BrowalliaUPC, CordiaUPC"><strong>รวม</strong></font></div></td>
<td width="40"><div align="center"><font size="3" face="AngsanaUPC, BrowalliaUPC, CordiaUPC"><strong>เกรด</strong></font></div></td>
</tr>
</table>
<?
$sql = "SELECT id_s,name_s,sname,class FROM student WHERE (id_s LIKE '".$_GET["id_s"]."%') ";
$dbquery = mysql_query($sql);
list( $id_s ,$name_s ,$sname , $class )= mysql_fetch_row($dbquery);
if(!$id_s)
{ echo"<br>";
echo "<font color='red'><b><center>ไม่พบรหัสบุคลากร=".$_GET["id_s"];
echo"<br></b></font>";
echo"<meta http-equiv=refresh content=3;URL=grade.php>";}
else {
?>
<table border="1" cellpadding="0" cellspacing="0" align="center">
<td width="90" height="20"> <div align="center"> <font face="AngsanaUPC, BrowalliaUPC, CordiaUPC"> <input id="class"type="hiddent" name="class" value="<?=$class?>"style="width:0px;border:none;text-align:center;" >
<? echo $id_s?>
<input id="id_s"type="hidden" name="id_s" value="<?=$id_s?>"style="width:70px;border:none;text-align:center;" >
</font></div></td>
<td width="100" height="20"> <font face="AngsanaUPC, BrowalliaUPC, CordiaUPC">
<? echo $name_s?>
<input id="name"type="hidden" name="name" value="<?=$name_s?>">
<td width="100" height="20"> <font face="AngsanaUPC, BrowalliaUPC, CordiaUPC">
<? echo $sname?>
<input id="sname"type="hidden" name="sname" value="<?=$sname?>">
</font></td>
</font></td>
<td width="70"><div align="center"> <font face="AngsanaUPC, BrowalliaUPC, CordiaUPC">
<input name="t1[]" type="text" id="t1" size="1" maxlength="2" style="width:20px;border:none;text-align:center;" />
</font></div></td>
<td width="70"><div align="center"> <font face="AngsanaUPC, BrowalliaUPC, CordiaUPC">
<input name="t2[]" type="text" id="t2" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum();digitsOnlyYouKnow(this);" size="1" maxlength="2" style="width:20px;border:none;text-align:center; "/>
</font></div></td>
<td width="40"><div align="center"> <font face="AngsanaUPC, BrowalliaUPC, CordiaUPC">
<input name="t3[]" type="text" id="t3" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum();digitsOnlyYouKnow(this);" size="1" maxlength="3" style="width:20px;border:none;text-align:center; "/>
</font></div></td>
<td width="40"><div align="center"> <font face="AngsanaUPC, BrowalliaUPC, CordiaUPC">
<input name="t4" type="text" id="t4[$a]" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" size="1" style="width:30px;border:none; text-align:center;"/>
</font></div></td>
</tr>
</table>
<font size="2"> </font>
<table align="center">
<tr><td>
<input type="submit" name="Submit" value="บันทึก"></td>
</tr></table> <? }?></center>
<font size="2"> </font><font size="2">
</font><font face="AngsanaUPC, BrowalliaUPC, CordiaUPC"><strong></strong></font>
<script language="javascript">
var obj= document.all;
function sum(){
for (var a=0; a<100 ;a++){
obj.t3[a].value=parseInt(obj.t1[a].value)+parseInt(obj.t2[a].value);
if ((!obj.t1[a].value)||(!obj.t2[a].value))
{
obj.t3[a].value='-';
obj.t4[a].value='-';
}
else if (obj.t3[a].value>100)
{
obj.t4[a].value='Error';
}
else if ((obj.t3[a].value>=obj.a1.value)||(obj.t3[a].value==100))
{
obj.t4[a].value='4';
}
else if ((obj.t3[a].value>=obj.b1.value)&&(obj.t3[a].value<=obj.b2.value))
{
obj.t4[a].value='3.5';
}
else if ((obj.t3[a].value>=obj.b3.value)&&(obj.t3[a].value<=obj.b4.value))
{
obj.t4[a].value='3';
}
else if ((obj.t3[a].value>=obj.c1.value)&&(obj.t3[a].value<=obj.c2.value))
{
obj.t4[a].value='2.5';
}
else if ((obj.t3[a].value>=obj.c3.value)&&(obj.t3[a].value<=obj.c4.value))
{
obj.t4[a].value='2';
}
else if ((obj.t3[a].value>=obj.d1.value)&&(obj.t3[a].value<=obj.d2.value))
{
obj.t4[a].value='1.5';
}
else if ((obj.t3[a].value>=obj.d3.value)&&(obj.t3[a].value<=obj.d4.value))
{
obj.t4[a].value='1';
}
else if (obj.t3[a].value<=obj.e2.value)
{
obj.t4[a].value='0';
}
}
}
</script>
</font><font face="AngsanaUPC, BrowalliaUPC, CordiaUPC"><strong></strong></font>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#000000" >
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="150" height="15" align="center" ><strong>ช่วงคะแนน</strong></td>
<td width="55" height="15" align="center" ><strong>ระดับ</strong></td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="150" height="15"><div align="center">
<input name="a1" type="text" id="a1" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="80" size="1" maxlength="3" style="width:24px;border:none;text-align:center; "/>
- 100</div></td>
<td width="55" height="15" align="center" >4</td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="150" height="15"><div align="center">
<input name="b1" type="text" id="b1" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="75" size="1" maxlength="2" style="width:24px;border:none; text-align:center; "/>
-
<input name="b2" type="text" id="b2" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="79" size="1" maxlength="2" style="width:24px;border:none; text-align:center; "/>
</div></td>
<td width="55" height="15" align="center" > 3.5</td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="150" height="15"><div align="center">
<input name="b3" type="text" id="b3" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="70" size="1" maxlength="2" style="width:24px;border:none; text-align:center; "/>
-
<input name="b4" type="text" id="b4" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="74" size="1" maxlength="2" style="width:24px;border:none; text-align:center; "/>
</div></td>
<td width="55" height="15" align="center" >3</td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="150" height="26"><div align="center">
<input name="c1" type="text" id="c1" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="65" size="1" maxlength="2" style="width:24px;border:none; text-align:center; "/>
-
<input name="c2" type="text" id="c2" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="69" size="1" maxlength="2" style="width:24px;border:none; text-align:center; "/>
</div></td>
<td width="55" height="26" align="center" > 2.5</td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="150" height="15"><div align="center">
<input name="c3" type="text" id="c3" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="60" size="1" maxlength="2" style="width:24px;border:none; text-align:center; "/>
-
<input name="c4" type="text" id="c4" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="64" size="1" maxlength="2" style="width:24px;border:none; text-align:center; "/>
</div></td>
<td width="55" height="15" align="center" >2</td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="150" height="15"><div align="center">
<input name="d1" type="text" id="d1" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="55" size="1" maxlength="2" style="width:24px;border:none; text-align:center; "/>
-
<input name="d2" type="text" id="d2" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="59" size="1" maxlength="2" style="width:24px;border:none; text-align:center; "/>
</div></td>
<td width="55" height="15" align="center" > 1.5</td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="150" height="15"><div align="center">
<input name="d3" type="text" id="d3" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="50" size="1" maxlength="2" style="width:24px;border:none; text-align:center;"/>
-
<input name="d4" type="text" id="d4" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="54" size="1" maxlength="2" style="width:24px;border:none; text-align:center; "/>
</div></td>
<td width="55" height="15" align="center" >1</td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="150" height="15"><div align="center">
0 -
<input name="e2" type="text" id="e2" onFocus="sum()" onBlur="sum()" onChange="sum()" onKeyUp="sum()" value="49" size="1" maxlength="2" style="width:24px;border:none; text-align:center; background-color:"/>
</div></td>
<td width="55" height="15" align="center" >0</td>
</tr>
</table>
<tr align="center"><td><label></label>
<label></label></td></tr>
</form>
<div align="center"><font size="2"> </font></div>
</body
></html>
?>
จะทำยังไงให้ตอนรันครั้งแรกรหัสนักศึกษากับชื่อนามสกุลไม่แสดงค่ะ คืออยากให้แสดงตอนที่ทำการค้นหาแล้วค่ะ
Tag : - - - -
|
|
|
|
|
|
Date :
2009-05-20 22:16:49 |
By :
little_finger |
View :
1228 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ช่วยบอก error ด้วยก็ดีน่ะครับ เพราะโค๊ดเยอะมาก
|
|
|
|
|
Date :
2009-05-21 08:17:35 |
By :
kanchen |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
พี่ๆ ทุกคนครับช่วยผมหน่อยคับ ตอนนี้ผมกำลังจะเขียน code ให้ server ติดต่อ กับตัว pda โดยผ่านบลูทูตทำไง คับ
|
|
|
|
|
Date :
2009-06-28 11:06:30 |
By :
bobnaruk |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
พี่ครับผมอยากได้ code เวลามีคนเข้าทาง url แบบทางลัดให้มันเข้าไม่ได้ครับ ในการเข้าต้องผ่านการ login มาก่อนครับต้องเขียน code ไงครับ
|
|
|
|
|
Date :
2009-06-29 10:23:22 |
By :
bobnaruk |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|