001.
<?php
require_once
(
'Connections/conn.php'
); ?>
002.
<?php
003.
if
(!function_exists(
"GetSQLValueString"
)) {
004.
function
GetSQLValueString(
$theValue
,
$theType
,
$theDefinedValue
=
""
,
$theNotDefinedValue
=
""
)
005.
{
006.
if
(PHP_VERSION < 6) {
007.
$theValue
= get_magic_quotes_gpc() ?
stripslashes
(
$theValue
) :
$theValue
;
008.
}
009.
010.
$theValue
= function_exists(
"mysql_real_escape_string"
) ? mysql_real_escape_string(
$theValue
) : mysql_escape_string(
$theValue
);
011.
012.
switch
(
$theType
) {
013.
case
"text"
:
014.
$theValue
= (
$theValue
!=
""
) ?
"'"
.
$theValue
.
"'"
:
"NULL"
;
015.
break
;
016.
case
"long"
:
017.
case
"int"
:
018.
$theValue
= (
$theValue
!=
""
) ?
intval
(
$theValue
) :
"NULL"
;
019.
break
;
020.
case
"double"
:
021.
$theValue
= (
$theValue
!=
""
) ? doubleval(
$theValue
) :
"NULL"
;
022.
break
;
023.
case
"date"
:
024.
$theValue
= (
$theValue
!=
""
) ?
"'"
.
$theValue
.
"'"
:
"NULL"
;
025.
break
;
026.
case
"defined"
:
027.
$theValue
= (
$theValue
!=
""
) ?
$theDefinedValue
:
$theNotDefinedValue
;
028.
break
;
029.
}
030.
return
$theValue
;
031.
}
032.
}
033.
034.
$editFormAction
=
$_SERVER
[
'PHP_SELF'
];
035.
if
(isset(
$_SERVER
[
'QUERY_STRING'
])) {
036.
$editFormAction
.=
"?"
. htmlentities(
$_SERVER
[
'QUERY_STRING'
]);
037.
}
038.
039.
if
((isset(
$_POST
[
"MM_insert"
])) && (
$_POST
[
"MM_insert"
] ==
"form1"
)) {
040.
$insertSQL
= sprintf(
"INSERT INTO tb_accept_human (student_id, name, lastname, code, list, version, accept, accept_other, food_other, address, officer, phone, email) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
,
041.
GetSQLValueString(
$_POST
[
'student_id'
],
"text"
),
042.
GetSQLValueString(
$_POST
[
'name'
],
"text"
),
043.
GetSQLValueString(
$_POST
[
'lastname'
],
"text"
),
044.
GetSQLValueString(
$_POST
[
'code'
],
"text"
),
045.
GetSQLValueString(
$_POST
[
'list'
],
"text"
),
046.
GetSQLValueString(
$_POST
[
'version'
],
"text"
),
047.
GetSQLValueString(isset(
$_POST
[
'accept'
]) ?
"true"
:
""
,
"defined"
,
"'Y'"
,
"'N'"
),
048.
GetSQLValueString(
$_POST
[
'accept_other'
],
"text"
),
049.
GetSQLValueString(
$_POST
[
'food_other'
],
"text"
),
050.
GetSQLValueString(
$_POST
[
'address'
],
"text"
),
051.
GetSQLValueString(
$_POST
[
'officer'
],
"text"
),
052.
GetSQLValueString(
$_POST
[
'phone'
],
"text"
),
053.
GetSQLValueString(
$_POST
[
'email'
],
"text"
));
054.
055.
mysql_select_db(
$database_conn
,
$conn
);
056.
$Result1
= mysql_query(
$insertSQL
,
$conn
)
or
die
(mysql_error());
057.
058.
$insertGoTo
=
"check_accept_human.php"
;
059.
if
(isset(
$_SERVER
[
'QUERY_STRING'
])) {
060.
$insertGoTo
.= (
strpos
(
$insertGoTo
,
'?'
)) ?
"&"
:
"?"
;
061.
$insertGoTo
.=
$_SERVER
[
'QUERY_STRING'
];
062.
}
063.
header(sprintf(
"Location: %s"
,
$insertGoTo
));
064.
}
065.
?>
066.
<!doctype html>
067.
<html>
068.
<head>
069.
<meta charset=
"utf-8"
>
070.
<title>แบบกรอกรายละเอียด</title>
071.
</head>
072.
073.
<body>
074.
<table width=
"814"
border=
"0"
align=
"center"
cellpadding=
"0"
cellspacing=
"0"
>
075.
<tr>
076.
<th width=
"1819"
bgcolor=
"#CCCCCC"
scope=
"col"
>แบบตอบรับ</th>
077.
</tr>
078.
<tr>
079.
<td bgcolor=
"#CCCCCC"
><table width=
"522"
border=0
" align="
center">
080.
<tr bgcolor=
"#999999"
>
081.
<th align=
"center"
valign=
"middle"
scope=
"col"
colortxt=
"red"
>คำชี้แจง : ขอให้นักศึกษาโปรดกรอกรายละเอียดให้ครบถ้วน</th>
082.
</tr>
083.
</table></td>
084.
</tr>
085.
<tr align=
"left"
>
086.
<td><form name=
"form1"
method=
"POST"
action=
"<?php echo $editFormAction; ?>"
>
087.
<p>1. ตอบรับการเข้าฝึกปฏิบัติเสริมทักษะ รหัสวิชา :
088.
<label
for
=
"code"
></label>
089.
<input type=
"text"
name=
"code"
id=
"code"
>
090.
ชุดวิชา :
091.
<label
for
=
"list"
></label>
092.
<input type=
"text"
name=
"list"
id=
"list"
>
093.
</p>
094.
<p>2. เลขประจำตัวนักศึกษา :
095.
<label
for
=
"phone"
></label>
096.
<input type=
"text"
name=
"student_id"
id=
"textfield4"
>
097.
ชื่อ :
098.
<label
for
=
"lastname"
></label>
099.
<input type=
"text"
name=
"name"
id=
"textfield2"
>
100.
นามสกุล
101.
:
102.
<label
for
=
"student_id"
></label>
103.
<input type=
"text"
name=
"lastname"
id=
"textfield3"
>
104.
รุ่นที่
105.
<label
for
=
"version"
></label>
106.
:
107.
<input name=
"version"
type=
"text"
id=
"version"
size=
"7"
>
108.
3. สามารถเข้ารับการฝึกปฏิบัติเสริมทักษะ
109.
<input name=
"accept"
type=
"checkbox"
id=
"accept"
>
110.
<label
for
=
"accept"
></label>
111.
ได้
112.
<input type=
"checkbox"
name=
"decline"
id=
"decline"
>
113.
<label
for
=
"decline"
></label>
114.
ไม่ได้ โปรดระบุเหตุผล
115.
<textarea name=
"accept_other"
id=
"accept_other"
></textarea>
116.
</p>
117.
<p>
118.
<label
for
=
"accept_other"
></label>
119.
4
120.
. อาหารที่รับประทาน :
121.
<input type=
"radio"
name=
"food_general"
id=
"radio"
value=
"food_general"
>
122.
<label
for
=
"food_general"
></label>
123.
ทั่วไป
124.
<input type=
"radio"
name=
"food_halal"
id=
"radio2"
value=
"radio2"
>
125.
<label
for
=
"food_halal"
></label>
126.
อิสลาม
127.
<input type=
"radio"
name=
"food_veget"
id=
"radio3"
value=
"radio3"
>
128.
<label
for
=
"food_veget"
></label>
129.
มังสวิรัติ
130.
<input type=
"radio"
name=
"food_j"
id=
"radio4"
value=
"radio4"
>
131.
<label
for
=
"food_j"
></label>
132.
เจ
133.
<input type=
"radio"
name=
"other"
id=
"radio5"
value=
"radio5"
>
134.
<label
for
=
"other"
></label>
135.
อื่นๆ (โปรดระบุ)
136.
<label
for
=
"food_other"
></label>
137.
<textarea name=
"food_other"
cols=
"100"
id=
"food_other"
></textarea>
138.
</p>
139.
<p>6. ที่อยู่
140.
:
141.
<label
for
=
"address"
></label>
142.
<textarea name=
"address"
cols=
"50"
rows=
"2"
id=
"address"
></textarea>
143.
7. สถานที่ทำงาน :
144.
<label
for
=
"officer"
></label>
145.
<textarea name=
"officer"
id=
"officer"
></textarea>
146.
</p>
147.
<p>8. โทรศัพท์ (ที่ติดต่อได้สะดวก) :
148.
<label
for
=
"textfield5"
></label>
149.
<input type=
"text"
name=
"phone"
id=
"textfield5"
>
150.
9. E-mail :
151.
<label
for
=
"email"
></label>
152.
<input name=
"email"
type=
"text"
id=
"email"
size=
"50"
>
153.
</p>
154.
<p>
155.
<center><input type=
"submit"
name=
"confirm"
id=
"confirm"
value=
"ส่งข้อมูล"
></center>
156.
</p>
157.
<input type=
"hidden"
name=
"MM_insert"
value=
"form1"
>
158.
</form></td>
159.
</tr>
160.
<tr>
161.
<td> </td>
162.
</tr>
163.
<tr>
164.
<td> </td>
165.
</tr>
166.
</table>
167.
</body>
168.
</html>