<form action="savescore_regis.php?register_id=<?echo $register_id ;?>&&course_id=<?echo $course_id ;?>" method="post" name="savescore"> <div class="panel-body"> <div class="row"> <div class="col-md-9"> <label>ชื่อกลุ่ม</label> <br> <select name=""class="form-control" OnChange="window.location='?register_id=<?echo $register_id ;?>&&course_id=<?echo $course_id ;?>&&item='+this.value;"> <option value="">-- กรุณาเลือกเรียน --</option> <?php $strSQL = "SELECT DISTINCT a.portion_id FROM registersub a LEFT OUTER JOIN register b on a.register_id =b.register_id LEFT OUTER JOIN portion r on a.portion_id =r.portion_id LEFT OUTER JOIN course br on b.course_id =br.course_id WHERE a.register_id = '$register_id'"; $objQuery = mysql_query($strSQL); while($objResult = mysql_fetch_array($objQuery)) { if($_GET["item"] == $objResult["portion_id"]) { $sel = "selected"; } else { $sel = ""; } ?> <option value="<?php echo $objResult["portion_id"];?>" <?php echo $sel;?>><?php echo $objResult["portion_id"];?></option> <?php } ?> </select> </div> <div class="col-md-3"></div> </div> <br> <div class="row"> <div class="col-md-12"> <div class="panel table-responsive"> <table class="table table-bordered table-hover"> <thead> <tr class="bg-primary"> <th size ="1" rowspan="2"width="5%" class="text-center">ที่</th> <th size ="1" rowspan="2"width="15%" class="text-center">รหัสนักศึกษา</th> <th rowspan="2"width="20%" class="text-center">ชื่อ-นาสกุล</th> <?php $sql = mysql_query("SELECT COUNT(*) FROM scorerunit"); $res = mysql_fetch_array($sql); $records = $res[0]; ?> <th colspan="<? echo $records ?>" width="30%"class="text-center">ชื่อหน่วยเรียน</th> <th rowspan="2" width="10%" class="text-center">รวม</th> <th rowspan="2"width="10%" class="text-center">%</th> <th rowspan="2"width="10%" class="text-center">เกรด</th> </tr> <tr class="bg-primary" width="5%"> <? $query_list=mysql_query("SELECT* from courseunit r inner join scorerunit s on r.scoreunit_id = s.scorerunit_id where course_id ='$course_id ' ") ; while($eee=mysql_fetch_array($query_list)) { ?> <td width=""><?echo $eee['scorerunit_name'];?> (<?echo $eee['score'];?>)</td> <? } ?> </tr> </thead> <tbody> <?php if($_GET["item"] != ""){ $strSQL = "SELECT * FROM registersub a LEFT OUTER JOIN register b on a.register_id =b.register_id LEFT OUTER JOIN portion r on a.portion_id =r.portion_id LEFT OUTER JOIN course br on b.course_id =br.course_id WHERE a.register_id = '$register_id' and a.portion_id = '".$_GET["item"]."'"; $objQuery = mysql_query($strSQL); while($eee=mysql_fetch_array($objQuery)){ ?> <tr class=" btn-xs " > <td size ="1" width="5%"><div name ="student_id"><?echo $eee['student_id'];?></div></td> <td size ="1" width="15%"><?echo $eee['student_code'];?></td> <td size ="5" width="20%"><? echo $eee['student_name'];?> <? echo $eee['student_lastname']; ?></td> <td width="10%"><div align="center"> <font face=""> <input name="score" type="text" id="score_" onkeyup="calculate('score_ ',this.value)" onKeyPress="CheckNum()"maxlength="3" class="form-control "/> </font></div></td> <td width="10%"><div align="center"> <font face=""> <input name="score2" type="text" id="score2_" onkeyup="calculate('score2_ ',this.value)" onKeyPress="CheckNum()"maxlength="3" class="form-control "/> </font></div></td> <td width="10%"><div align="center"> <font face=""> <input name="score3" type="text" id="score3_" onkeyup="calculate('score3_ ',this.value)" onKeyPress="CheckNum()"maxlength="3" class="form-control "/> </font></div></td> <td width="10%"><div align="center"> <font face=""> <input type="text" name="scorefull" id="scorefull" maxlength="3" class="form-control "readonly /> </font></div></td> <td width="10%"><div align="center"> <font face=""> <input name="scoure%" type="text" id="scoure4" readonly maxlength="3" class="form-control " /> </font></div></td> <td width="10%"><div align="center"> <font face=""> <input name="scoregrad" type="text" id="scoregrad" maxlength="3" class="form-control "readonly /> </font></div></td> </tr> <? } ?> <? } ?> </tbody> </table> </form> </div> </div> <script type='text/javascript'> function checkNumber(elm){ if(elm.value>50){ alert('กรอกตัวเลขได้ไม่เกิน 50 เท่านั้น'); elm.value=''; } } </script> <script language="javascript"> function CheckNum(){ if (event.keyCode < 48 || event.keyCode > 57){ event.returnValue = false; } } </script> <script language="javascript"> function calculate() { var scorefull_ = 0; var scoregrad = "-"; var scoure4_ = "-"; var score = parseInt(document.getElementById('score_').value); var score2 = parseInt(document.getElementById('score2_' ).value); var score3 = parseInt(document.getElementById('score3_').value); if ( isNaN(score) ) { score = 0; } if ( isNaN(score2) ) { score2 = 0; } if ( isNaN(score3) ) { score3 = 0; } scorefull_=score+score2+score3; if (scorefull_) { scoure4_ = (scorefull_ /100)*80; document.getElementById('scoure4').value = scoure4_; } if (scorefull_>=50) { document.getElementById('scoregrad').value = "a"; } document.getElementById('scorefull').value = scorefull_; if(scorefull_>100) { alert('กรอกตัวเลขได้ไม่เกิน 100 เท่านั้น'); if (score > 0 ) { score5 = scorefull_ - 100; score6 = score- score5; document.getElementById('score_').value =score6; } else if ( score2 > 0) { score5 = scorefull_ - 100; score7 = score2- score5; document.getElementById('score2_').value =score7; } else if ( score3 > 0) { score5 = scorefull_ - 100; score8 = score3- score5; document.getElementById('score3_').value =score8; } document.getElementById('scorefull').value =100; } } </script> </div> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal">ยกเลิก</button> <button type="submit" class="btn btn-primary" >บันทึก</button> </div> </div> </div> </div> </form>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง