Viewing file: addCourseNurse.php (4.91 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
session_start();
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Check Session User Login */
if (! session_is_registered("valid_user") ) {
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\" />";
echo "<p style=padding-top:115px><p align=center><br /><font color=red><strong>กรุณาทำการ Login ก่อน</strong></font></p></p>";
echo "<meta http-equiv=\"refresh\" content=\"1; URL=../login.php\" />";
exit();
}
else {
/** Configuration */
require_once( "../configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once( "../includes/FunctionDB.php" );
/** Create Database Object */
$dbObj = new DBConn;
//### รับค่าจาก Form
$CourseName = htmlspecialchars(trim($_POST['CourseName']));
$AcademicYear = htmlspecialchars(trim($_POST['AcademicYear']));
if(isset($_REQUEST["action"])){
if($_REQUEST["action"]=="add"){
$query1 = "INSERT INTO course_nurse ( CourseName , AcademicYear ) VALUES (' ".$_REQUEST["CourseName"]."' , '".$_REQUEST["AcademicYear"]."' ) ";
}
if($_REQUEST["action"]=="edit"){
$query1 = "UPDATE course_nurse SET CourseName=' ".$_REQUEST["CourseName"]." ' , AcademicYear=' ".$_REQUEST["AcademicYear"]." ' WHERE coseId='".$_REQUEST["coseId"]." ' " ;
}
$result1 = $dbObj->runQuery($query1);
$dbObj->disconn();
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\" />";
echo "<script>alert('บันทึกข้อมูลเรียบร้อยแล้ว');</script>";
echo "<script>window.close(); window.opener.location.href='CourseNurseList.php'; </script>";
}
else{
$sql = "Select * From course_nurse Where coseId='$coseId' ";
$result = mysql_query($sql) or die(" Error").mysql_error();
$rss = mysql_fetch_array($result);
}
} #else
?>
<meta http-equiv="Content-Type" content="text/html; charset=TIS-620">
<link href="../css/default.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="../js/utilities.js"></script>
<table width="566" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="566" height="194">
<fieldset>
<legend>เพิ่ม/แก้ไข รายวิชาสอบสภาการพยาบาล</legend>
<form id="form1" name="form1" method="post">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:#eeeeee; border:0px solid gray; font-size: 14px;"size="12">
<tr bgcolor="#F3F3F3">
<td width="30%" height="22" align="right" bordercolor="#CCCCCC" bgcolor="#FFFFFF"> </td>
<td width="70%" bordercolor="#FFFFCC" bgcolor="#FFFFFF"> </td>
</tr>
<tr bgcolor="#F3F3F3">
<td width="30%" height="22" align="right" bordercolor="#CCCCCC" bgcolor="#FFFFFF">ชื่อวิชา ::</td>
<td width="70%" bordercolor="#FFFFCC" bgcolor="#FFFFFF">
<input name="CourseName" type="text" class="style4" id="CourseName" value="<?=(isset($rss["CourseName"]))?$rss["CourseName"]:"";?>" size="50"/>
</td>
</tr>
<tr bgcolor="#F3F3F3">
<td bordercolor="#CCCCCC" bgcolor="#FFFFFF"> </td>
<td bordercolor="#FFFFCC" bgcolor="#FFFFFF"> </td>
</tr>
<tr bgcolor="#F3F3F3">
<td align="right" bordercolor="#CCCCCC" bgcolor="#FFFFFF">ปีการศึกษา ::</td>
<td bordercolor="#FFFFCC" bgcolor="#FFFFFF"><input name="AcademicYear" type="text" class="style4" id="AcademicYear" value="<?=(isset($rss["AcademicYear"]))?$rss["AcademicYear"]:"";?>" size="5" maxlength="5" /></td>
</tr>
<tr bgcolor="#F3F3F3">
<td bordercolor="#CCCCCC" bgcolor="#FFFFFF"> </td>
<td bordercolor="#FFFFCC" bgcolor="#FFFFFF"> </td>
</tr>
<tr bgcolor="#F3D6F2">
<td colspan="2" bgcolor="#FFFFFF"><div align="center">
<input name="Submit" type="submit" class="WIDTH60" id="Submit" value="บันทึก" />
<input name="Reset" type="reset" class="WIDTH60" id="Reset" value="Reset" />
<input type="button" name="Submit" value="ปิดหน้าต่าง" onclick="javascript:parent.close();" class="CURSOR-HAND" id="Submit" />
<input name="action" type="hidden" id="action" value="<?=(isset($_REQUEST["coseId"]))?"edit":"add"; ?>" />
<input name="coseId" type="hidden" id="coseId" value="<?=(isset($_REQUEST["coseId"]))?$_REQUEST["coseId"]:""; ?>" />
</div></td>
</tr>
</table>
</form>
</fieldset>
</font></td>
</tr>
</table>
|