โค้ดใส่ข้อมูล
<?php require_once('Connections/myconect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO mama (stu_id, name, `year`, yearstu, faculty, education, sector, sectorr, adviser, department_id, department_name, cedit, `group`, GPA, style, gread) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['stu_id'], "int"),
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['year'], "text"),
GetSQLValueString($_POST['yearstu'], "text"),
GetSQLValueString($_POST['faculty'], "text"),
GetSQLValueString($_POST['education'], "text"),
GetSQLValueString($_POST['sector'], "text"),
GetSQLValueString($_POST['sectorr'], "text"),
GetSQLValueString($_POST['adviser'], "text"),
GetSQLValueString($_POST['department_id'], "text"),
GetSQLValueString($_POST['department_name'], "text"),
GetSQLValueString($_POST['credit'], "text"),
GetSQLValueString($_POST['group'], "text"),
GetSQLValueString($_POST['GPA'], "text"),
GetSQLValueString($_POST['style'], "text"),
GetSQLValueString($_POST['gread'], "double"));
mysql_select_db($database_myconect, $myconect);
$Result1 = mysql_query($insertSQL, $myconect) or die(mysql_error());
}
mysql_select_db($database_myconect, $myconect);
$query_cnblue = "SELECT * FROM mama";
$cnblue = mysql_query($query_cnblue, $myconect) or die(mysql_error());
$row_cnblue = mysql_fetch_assoc($cnblue);
$totalRows_cnblue = mysql_num_rows($cnblue);
?>
<!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST">
<p>มหาวิทยาลัยเกริก (ม.กร) </p>
<p>รหัสนักศึกษา
<label for="textfield46"></label>
<input type="text" name="stu_id" id="textfield46" />
</p>
<p>GPA
<label for="year"></label>
<input type="text" name="GPA" id="textfield2" />
</p>
<p>ภาค
<label for="sector"></label>
<label for="sector"></label>
<select name="sector" id="sector">
<option value="ต้น" selected="selected">ต้น</option>
<option value="ปลาย">ปลาย</option>
<option value="ฤดูร้อน">ฤดูร้อน</option>
</select>
</p>
<p>ปีการศึกษา
<label for="name"></label>
<input type="text" name="year" id="textfield3" />
</p>
<p>ชื่อ
<label for="yearstu"></label>
<input type="text" name="name" id="textfield4" />
</p>
<p>นักศึกษาชั้นปี
<label for="faculty"></label>
<input type="text" name="yearstu" id="textfield5" />
</p>
<p>ภาค
<label for="sectorr"></label>
<select name="sectorr" id="sectorr">
<option value="ปกติ" selected="selected">ปกติ</option>
<option value="ภาคค่ำ">ภาคค่ำ</option>
</select>
</p>
<p>รูปแบบ
<label for="style"></label>
<select name="style" id="style">
<option value="4 ปี">4 ปี</option>
<option value="ต่อเนื่อง">ต่อเนื่อง</option>
<option value="เทียบโอน">เทียบโอน</option>
</select>
</p>
<p>คณะ
<label for="education"></label>
<input type="text" name="faculty" id="textfield6" />
</p>
<p>สาขา
<label for="adviser"></label>
<input type="text" name="education" id="textfield7" />
</p>
<p id="GPA">อาจารย์ที่ปรึกษา
<label for="textfield8"></label>
<input type="text" name="adviser" id="textfield8" />
</p>
<table width="1380" height="301" border="1">
<tr>
<td width="137"><blockquote>
<p>รหัสวิชา</p>
</blockquote></td>
<td width="382"><blockquote>
<blockquote>
<blockquote>
<blockquote>
<p>ชื่อวิชา</p>
</blockquote>
</blockquote>
</blockquote>
</blockquote></td>
<td width="66">หน่วยกิต</td>
<td width="60">กลุ่ม </td>
<td width="60">เกรด</td>
<td width="60">แต้ม</td>
<td width="569">เอกสารฉบับบนี้ให้แทนใบเสร็จรับเงิน</td>
</tr>
<tr>
<td><label for="department_id"></label>
<input name="department_id" type="text" id="department_id" size="15" /></td>
<td><label for="department_name"></label>
<input name="department_name" type="text" id="department_name" size="10" /></td>
<td><label for="credit"></label>
<input name="credit" type="text" id="credit" size="10" /></td>
<td><label for="group"></label>
<input name="group" type="text" id="group" size="10" /></td>
<td><label for="gread"></label>
<input name="gread" type="text" id="gread" size="10" /></td>
<td><label for="textfield39"></label>
<input name="textfield39" type="text" id="textfield39" size="10" /></td>
<td rowspan="7" valign="top"><p> เดิมลงทะเบียน
<label for="education"></label>
<label for="education"></label>
<input name="textfield6" type="text" id="textfield6" size="5" />
หน่วยกิต</p>
<p>ขอเพิ่ม
<label for="adviser"></label>
<input name="textfield7" type="text" id="textfield7" size="5" />
หน่วยกิต</p>
<p>รวมเป็น
<label for="textfield8"></label>
<input name="textfield8" type="text" id="textfield8" size="5" />
หน่วยกิต</p>
<p>ชำระเงินเพิ่ม (ถ้ามี)
<label for="textfield9"></label>
<input name="textfield9" type="text" id="textfield9" size="5" />
บาท</p>
<p>ลงนาม</p>
<p> </p>
<p>จนท.การเงิน</p>
<p>......./....../......</p></td>
</tr>
<tr>
<td><label for="epartment_id"></label>
<input name="epartment_id" type="text" id="epartment_id" size="15" /></td>
<td><label for="deportment_name"></label>
<input name="deportment_name" type="text" id="deportment_name" size="10" /></td>
<td><label for="credit"></label>
<input name="credit" type="text" id="credit" size="10" /></td>
<td><label for="textfield28"></label>
<input name="textfield28" type="text" id="textfield28" size="10" /></td>
<td><label for="textfield34"></label>
<input name="textfield34" type="text" id="textfield34" size="10" /></td>
<td><label for="textfield40"></label>
<input name="textfield40" type="text" id="textfield40" size="10" /></td>
</tr>
<tr>
<td><label for="textfield12"></label>
<input name="textfield12" type="text" id="textfield12" size="15" /></td>
<td><label for="textfield18"></label>
<input name="textfield18" type="text" id="textfield18" size="10" /></td>
<td><label for="textfield23"></label>
<input name="textfield23" type="text" id="textfield23" size="10" /></td>
<td><label for="textfield29"></label>
<input name="textfield29" type="text" id="textfield29" size="10" /></td>
<td><label for="textfield35"></label>
<input name="textfield35" type="text" id="textfield35" size="10" /></td>
<td><label for="textfield41"></label>
<input name="textfield41" type="text" id="textfield41" size="10" /></td>
</tr>
<tr>
<td><label for="textfield13"></label>
<input name="textfield13" type="text" id="textfield13" size="15" /></td>
<td><label for="textfield19"></label>
<input name="textfield19" type="text" id="textfield19" size="10" /></td>
<td><label for="textfield24"></label>
<input name="textfield24" type="text" id="textfield24" size="10" /></td>
<td><label for="textfield30"></label>
<input name="textfield30" type="text" id="textfield30" size="10" /></td>
<td><label for="textfield36"></label>
<input name="textfield36" type="text" id="textfield36" size="10" /></td>
<td><label for="textfield42"></label>
<input name="textfield42" type="text" id="textfield42" size="10" /></td>
</tr>
<tr>
<td><label for="textfield14"></label>
<input name="textfield14" type="text" id="textfield14" size="15" /></td>
<td><label for="textfield20"></label>
<input name="textfield20" type="text" id="textfield20" size="10" /></td>
<td><label for="textfield25"></label>
<input name="textfield25" type="text" id="textfield25" size="10" /></td>
<td><label for="textfield31"></label>
<input name="textfield31" type="text" id="textfield31" size="10" /></td>
<td><label for="textfield37"></label>
<input name="textfield37" type="text" id="textfield37" size="10" /></td>
<td><label for="textfield43"></label>
<input name="textfield43" type="text" id="textfield43" size="10" /></td>
</tr>
<tr>
<td><label for="textfield15"></label>
<input name="textfield15" type="text" id="textfield15" size="15" /></td>
<td>รวม
<label for="textfield45"></label>
<input name="textfield45" type="text" id="textfield45" size="10" /></td>
<td><label for="textfield26"></label>
<input name="textfield26" type="text" id="textfield26" size="10" /></td>
<td><label for="textfield32"></label>
<input name="textfield32" type="text" id="textfield32" size="10" /></td>
<td><label for="textfield38"></label>
<input name="textfield38" type="text" id="textfield38" size="10" /></td>
<td><label for="textfield44"></label>
<input name="textfield44" type="text" id="textfield44" size="10" /></td>
</tr>
<tr>
<td height="102"> </td>
<td align="right"><blockquote>
<blockquote>
<blockquote>
<blockquote>
<p> </p>
</blockquote>
</blockquote>
</blockquote>
</blockquote></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<label for="GPA"></label>
<td> </td>
<td> </td>
<td> </td>
<td><p> </p>
<p>
<input type="submit" name="button" id="button" value="บันทึก" />
</p></td>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>
<?php
mysql_free_result($cnblue);
?>

ไม่มีความคิดเห็น:
แสดงความคิดเห็น