01.
<?
02.
$objConnect
= mysql_connect(
"localhost"
,
""
,
""
)
or
die
(
"Error Connect to Database"
);
03.
$objDB
= mysql_select_db(
"db"
);
04.
05.
if
(
$_GET
[
"Action"
] ==
"Save"
)
06.
{
07.
08.
09.
$strSQL
=
"INSERT INTO webboard "
;
10.
$strSQL
.=
"(CreateDate,Question,Details,Name) "
;
11.
$strSQL
.=
"VALUES "
;
12.
$strSQL
.=
"('"
.
date
(
"Y-m-d H:i:s"
).
"','"
.
$_POST
[
"txtQuestion"
].
"','"
.
$_POST
[
"txtDetails"
].
"','"
.
$_POST
[
"txtName"
].
"') "
;
13.
$objQuery
= mysql_query(
$strSQL
);
14.
15.
header(
"location:uppost.php"
);
16.
}
17.
?>
18.
<html>
19.
<head>
20.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
21.
<title>ThaiCreate.Com</title>
22.
<style type=
"text/css"
>
23.
<!--
24.
body,td,th {
25.
font-family: Tahoma;
26.
font-size: 14px;
27.
}
28.
-->
29.
</style>
30.
</head>
31.
<body>
32.
33.
<form action=
"uppost.php?Action=Save"
method=
"post"
name=
"frmMain"
id=
"frmMain"
>
34.
<table width=
"621"
border=
"1"
align=
"center"
cellpadding=
"1"
cellspacing=
"1"
>
35.
<tr>
36.
<td width=
"100"
height=
"46"
>ข้อความ</td>
37.
<td>
38.
<select name=
"txtDetails"
id=
"txtDetails"
>
39.
<option selected>ยินดีต้อนรับ</option>
40.
<option>ทรงพระเจริญ</option>
41.
</select>
42.
</td>
43.
</tr>
44.
<tr>
45.
<td width=
"100"
height=
"43"
>ชื่อ</td>
46.
<td width=
"647"
>
47.
<select name=
"txtName"
itype=
"text"
id=
"txtName"
value=
""
>
48.
<option selected>นาย ทดสอบ0</option>
49.
<option>นาย ทดสอบ1</option>
50.
</select></td>
51.
</tr>
52.
<tr>
53.
<td width=
"100"
height=
"41"
> </td>
54.
<td width=
"647"
><input name=
"btnSave"
type=
"button"
id=
"btnSave"
value=
"Submit"
></td>
55.
56.
</tr>
57.
</table>
58.
59.
<p>
60.
<tr>
61.
<td> </td>
62.
</tr>
63.
</p>
64.
</form>
65.
</body>
66.
</html>
67.
<?
68.
mysql_close(
$objConnect
);
69.
?>