Viewing file: Insert.php (5.69 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php session_start(); if (session_is_registered("valid_user")) { include("../../../include/FunctionDB.php"); include("../../../include/Function.php"); ConnectDB();
$Flag = true; $Term = htmlspecialchars(trim($_POST[Term])); $Course_code = htmlspecialchars(trim($_POST[Course_code])); $Series = htmlspecialchars(trim($_POST[Series]));
////////////////// X-bar $x1 = htmlspecialchars(trim($_POST[x1])); $x2 = htmlspecialchars(trim($_POST[x2])); $x3 = htmlspecialchars(trim($_POST[x3])); $x4 = htmlspecialchars(trim($_POST[x4])); $x5 = htmlspecialchars(trim($_POST[x5])); $x6 = htmlspecialchars(trim($_POST[x6])); $x7 = htmlspecialchars(trim($_POST[x7])); $x8 = htmlspecialchars(trim($_POST[x8])); $x9 = htmlspecialchars(trim($_POST[x9])); $x10 = htmlspecialchars(trim($_POST[x10])); $x11 = htmlspecialchars(trim($_POST[x11])); $x12 = htmlspecialchars(trim($_POST[x12])); $x13 = htmlspecialchars(trim($_POST[x13])); ////////////// S D $sd1 = htmlspecialchars(trim($_POST[sd1])); $sd2 = htmlspecialchars(trim($_POST[sd2])); $sd3= htmlspecialchars(trim($_POST[sd3])); $sd4= htmlspecialchars(trim($_POST[sd4])); $sd5= htmlspecialchars(trim($_POST[sd5])); $sd6 = htmlspecialchars(trim($_POST[sd6])); $sd7 = htmlspecialchars(trim($_POST[sd7])); $sd8 = htmlspecialchars(trim($_POST[sd8])); $sd9 = htmlspecialchars(trim($_POST[sd9])); $sd10 = htmlspecialchars(trim($_POST[sd10])); $sd11 = htmlspecialchars(trim($_POST[sd11])); $sd12 = htmlspecialchars(trim($_POST[sd12])); $sd13 = htmlspecialchars(trim($_POST[sd13])); ///////// Rate $rate1 = htmlspecialchars(trim($_POST[rate1])); $rate2 = htmlspecialchars(trim($_POST[rate2])); $rate3 = htmlspecialchars(trim($_POST[rate3])); $rate4 = htmlspecialchars(trim($_POST[rate4])); $rate5= htmlspecialchars(trim($_POST[rate5])); $rate6 = htmlspecialchars(trim($_POST[rate6])); $rate7 = htmlspecialchars(trim($_POST[rate7])); $rate8 = htmlspecialchars(trim($_POST[rate8])); $rate9 = htmlspecialchars(trim($_POST[rate9])); $rate10 = htmlspecialchars(trim($_POST[rate10])); $rate11 = htmlspecialchars(trim($_POST[rate11])); $rate12 = htmlspecialchars(trim($_POST[rate12])); $rate13 = htmlspecialchars(trim($_POST[rate13])); $rate14= htmlspecialchars(trim($_POST[rate14]));
/////////////// Check Duplicate ///////////////////////////////////// $sql3 = "Select * From std_employer_tb Where Term='$Term' AND Course_code='$Course_code'"; $result3 = mysql_query($sql3) or die("Error $result3".mysql_error()); $Check= mysql_num_rows($result3); if ($Check > 0 ) { $msg .="<li> มีในแบบบันทึกในฐานข้อมูลก่อนหน้า แล้ว"; $button ="<input type=\"button\" value=\"Back to Edit\" onclick=\"history.back();\" style=\"font-weight:bold;color:#FFF;background-color:#036;border-style:outset;border-color:#69F;font-family:Tohoma;\">"; $Flag = false; } ////////////////////////// check First name if ($Term =="") { $msg .="<li>กรุณาระบุ ปีการศึกษา"; $button ="<input type=\"button\" value=\"กลับไปแก้ไข\" onclick=\"history.back();\" style=\"font-weight:bold;color:#FFF;background-color:#036;border-style:outset;border-color:#69F;font-family:Tohoma;\">"; $Flag = false; } ///////////////////////////check Couse if ($Course_code == "") { $msg .="<li>กรุณาระบุ หลักสูตร"; $button ="<input type=\"button\" value=\"กลับไปแก้ไข\" onclick=\"history.back();\" style=\"font-weight:bold;color:#FFF;background-color:#036;border-style:outset;border-color:#69F;font-family:Tohoma;\">"; $Flag = false; } ///////////////////////// Check Status to Insert Data /////////////////////////////
if( $Flag) { InsertEmployer($Term,$Course_code,$Series,$x1,$x2,$x3,$x4,$x5,$x6,$x7,$x8,$x9,$x10,$x11,$x12,$x13,$sd1,$sd2,$sd3,$sd4,$sd5,$sd6,$sd7,$sd8,$sd9,$sd10,$sd11,$sd12,$sd13,$rate1,$rate2,$rate3,$rate4,$rate5,$rate6,$rate7,$rate8,$rate9,$rate10,$rate11,$rate12,$rate13) ; $msg.="<li>ระบบจัดเก็บข้อมูลเรียบร้อยแล้ว"; echo"<meta http-equiv=\"refresh\" content=\"2;URL=StatisticList.php\">\n"; } CloseDB(); ?> <html> <head> <title>Student</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-874"> <link rel="stylesheet" href="../../../css/style1.css" type="text/css"> </head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0"marginwidth="0"marginheight="0"> <form> <br> <table width="70%" border="0" cellspacing="0"cellpadding="2"align="center"> <tr> <td><div align="center"><span><b><font color="#003399" size="4" face="Tahoma">:: แบบฟอร์มบันทึกข้อมูลบัณฑิต ::</font></b></span></div></td> </tr> <tr> <td> <table width="100%" border="0"align="center"cellpadding="0" cellspacing="1" bgcolor="#E8EEFD" class="table"> <tr> <td bgcolor="#E8EEFD"><div align="center"><b><font color="#003333" size="2" face="Tahoma">ระบบแจ้งการทำงาน</font></b></div></td> </tr> <tr> <td bgcolor="#000000"> <table width="90%" border="0" cellspacing="0"cellpadding="2"align="center"> <tr> <td><span><b><font color="#FFFFFF"><?php echo $msg;?></font></b></span></td> </tr> </table> </td> </tr> <tr> <td bgcolor="#E8EEFD"> <div align="center"><b><font color="#CCFF00"><?php echo $button;?> <font size="2" face="Tahoma"></font></font></b></div></td> </tr> </table> </td> </tr> </table> <br> </form> </body> </html> <?php } else { echo"<body bgcolor=\"#CCCCCC\">"; echo"<meta http-equiv=\"refresh\" content=\"3;URL=../../../../logout.php\" target=\"mainFrame\">\n"; echo"<center>"; echo"<br><br><br><b><font face=\"Tahoma\" size=\"4\" color=\"#FF0000\">Please Login</font> </b><br>"; echo"<br><br><font face=\"Tahoma\" size=\"10\" color=\"#000000\"> ERROR 404 PERMISION DENY</font><br>"; echo"<br><font face=\"Tahoma\" size=\"4\" color=\"#000000\"> คุณไม่มีสิทธ์ใช้งาน</font>"; echo"</center>"; echo"</body>"; } ?>
|