01.
<?php
require_once
(
'Connections/sttb_connections.php'
); ?>
02.
<html>
03.
<head>
04.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
05.
<title>New Training Record</title>
06.
</head>
07.
08.
<body>
09.
<!---------------------| New Record Table | --------------------->
10.
11.
<form name=
"save"
method=
"POST"
enctype=
"multipart/form-data"
action=
"trainRecAdd_page.php"
>
12.
<table
class
=
"table"
>
13.
<tr>
14.
<td width=
"10%"
><div style=
"padding:10px"
><span
class
=
"glyphicon glyphicon-asterisk"
style=
"color:#C00"
></span> Subject</div></td>
15.
<td width=
"90%"
>
16.
<div
class
=
"row"
><div
class
=
"col-xs-4"
>
17.
<input type=
"text"
name=
"trn_name"
class
=
"form-control"
style=
"font-size:17px"
maxlength=100 required/>
18.
</div></div>
19.
</td>
20.
</tr>
21.
22.
<tr>
23.
<td><div style=
"padding:10px"
><span
class
=
"glyphicon glyphicon-asterisk"
style=
"color:#C00"
></span> Section</div></td>
24.
<td>
25.
<div
class
=
"row"
><div
class
=
"col-xs-4"
>
26.
<select name=
"id_section"
class
=
"btn btn-default dropdown-toggle"
required>
27.
<option value=
""
>- Select -</option>
28.
<?php
29.
$sql_sec
=
" SELECT * FROM sttb_section ORDER BY id_section ASC "
;
30.
$qry_sec
= mysql_query(
$sql_sec
);
31.
32.
while
(
$arr_sec
= @mysql_fetch_array(
$qry_sec
))
33.
{ ?><option value=
"<?php echo $arr_sec["
id_section
"]; ?>"
><?php
echo
$arr_sec
[
"sec_name"
]; ?></option><?php } ?>
34.
</select>
35.
</div></div>
36.
</td>
37.
</tr>
38.
39.
<tr>
40.
<td><div style=
"padding:10px"
><span
class
=
"glyphicon glyphicon-asterisk"
style=
"color:#C00"
></span> File</div></td>
41.
<td><input type=
"file"
name=
"trn_file"
class
=
"btn btn-default"
required></td>
42.
</tr>
43.
</table>
44.
45.
<div style=
"padding-left:200px"
>
46.
<!--- *Botton Save* --->
47.
<button type=
"submit"
name=
"save"
class
=
"btn btn-success"
><span
class
=
"glyphicon glyphicon-floppy-disk"
></span> Save</button>
48.
49.
<!-- *Botton Cancel* -->
50.
<a href=
"trainRecord_page.php"
class
=
"btn btn-danger"
><font color=
"#FFFFFF"
><span
class
=
"glyphicon glyphicon-ban-circle"
></span> Cancel</font></a>
51.
</div>
52.
53.
</form>
54.
<!-----------------------------
End
Record Table ------------------------------>
55.
56.
57.
58.
<!---------------------------- Insert In Data Base ---------------------------->
59.
<?php
60.
if
(isset(
$_POST
[
"save"
]))
61.
{
62.
$sql_trn
= " INSERT INTO sttb_training(
'trn_name'
,
'id_section'
)
63.
VALUES(
'".$_POST["trn_name"]."'
,
'".$_POST["id_section"]."'
) ";
64.
$qry_trn
= mysql_db_query(
$sttb_connections
,
$sql_trn
)
or
die
(
"Can't Select Database ["
.
$sql_trn
.
"]"
);
65.
66.
if
(
$qry_trn
)
67.
{
echo
'<script>alert("Save done");</script>'
; }
68.
69.
else
70.
{
echo
"Error Save ["
.
$sql_trn
.
"]"
; }
71.
}
72.
?>
73.
</body>
74.
</html>