-
Notifications
You must be signed in to change notification settings - Fork 17
/
Subject_Entry.php
227 lines (192 loc) · 8.03 KB
/
Subject_Entry.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?php
$id="";
$opr="";
if(isset($_GET['opr']))
$opr=$_GET['opr'];
if(isset($_GET['rs_id']))
$id=$_GET['rs_id'];
if(isset($_POST['btn_sub'])){
$fa_name=$_POST['factxt'];
$teach_name=$_POST['techtxt'];
$semester=$_POST['semestertxt'];
$sub_name=$_POST['subtxt'];
$note=$_POST['notetxt'];
$sql_ins=mysql_query("INSERT INTO sub_tbl
VALUES(
NULL,
'$fa_name',
'$teach_name' ,
'$semester',
'$sub_name' ,
'$note'
)
");
if($sql_ins==true)
$msg="1 Row Inserted";
else
$msg="Insert Error:".mysql_error();
}
//------------------update data----------
if(isset($_POST['btn_upd'])){
$fac_id=$_POST['factxt'];
$tea_id=$_POST['techtxt'];
$semester=$_POST['semestertxt'];
$sub_name=$_POST['subtxt'];
$note=$_POST['notetxt'];
$sql_update=mysql_query("UPDATE sub_tbl SET
faculties_id='$fac_id' ,
teacher_id='$tea_id' ,
semester='$semester' ,
sub_name='$sub_name' ,
note='$note'
WHERE sub_id=$id
");
if($sql_update==true)
echo "<div style='background-color: white;padding: 20px;border: 1px solid black;margin-bottom: 25px;''>"
. "<span class='p_font'>"
. "Record Updated Successfully... !"
. "</span>"
. "</div>";
else
$msg="Update Failed...!";
}
?>
<!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" />
<link rel="stylesheet" type="text/css" href="css/style_entry.css" />
</head>
<body>
<?php
if($opr=="upd")
{
$sql_upd=mysql_query("SELECT * FROM sub_tbl WHERE sub_id=$id");
$rs_upd=mysql_fetch_array($sql_upd);
?>
<div class="panel panel-default">
<div class="panel-heading"><h1><span class="glyphicon glyphicon-th-list"></span> Subject's Update Form</h1></div>
<div class="panel-body">
<div class="container">
<p style="text-align:center;">Here, you'll update your subject's records into database.</p>
</div>
<form method="post">
<div class="teacher_bday_box" style="margin-left: 0px;">
<div class="select_style">
<select name="factxt" style="width: 200px;">
<option>Facultie's name</option>
<?php
$fac_name=mysql_query("SELECT * FROM facuties_tbl");
while($row=mysql_fetch_array($fac_name)){
if($row['faculties_id']==$rs_upd['faculties_id'])
$iselect="selected";
else
$iselect="";
?>
<option value="<?php echo $row['faculties_id'];?>" <?php echo $iselect;?> > <?php echo $row['faculties_name'];?> </option>
<?php
}
?>
</select>
</div>
</div><br><br>
<div class="teacher_bday_box" style="margin-left: 0px;">
<div class="select_style">
<select name="techtxt" style="width: 200px">
<option>Teacher's name</option>
<?php
$te_name=mysql_query("SELECT * FROM teacher_tbl");
while($row=mysql_fetch_array($te_name)){
if($row['teacher_id']==$rs_upd['teacher_id'])
$iselect="selected";
else
$iselect="";
?>
<option value="<?php echo $row['teacher_id'];?>" <?php echo $iselect?> > <?php echo $row['f_name'] ; echo " "; echo $row['l_name'];?> </option>
<?php
}
?>
</select>
</div>
</div><br><br>
<div class="teacher_note_pos">
<input type="text" class="form-control" name="semestertxt" id="textbox" value="<?php echo $rs_upd['semester'];?>" />
</div><br>
<div class="teacher_note_pos">
<input type="text" class="form-control" name="subtxt" id="textbox" value="<?php echo $rs_upd['sub_name'];?>" />
</div><br>
<div class="text_box_pos">
<textarea name="notetxt" class="form-control" cols="23" rows="3"><?php echo $rs_upd['note'];?></textarea>
</div><br><br>
<div>
<input type="submit" class="btn btn-primary btn-large" name="btn_upd" value="Update" id="button-in" />
<input type="reset" style="margin-left: 9px;" class="btn btn-primary btn-large" value="Cancel" id="button-in"/>
</div>
</form>
</div>
</form>
</div>
<?php
}
else
{
?>
<div class="panel panel-default">
<div class="panel-heading"><h1><span class="glyphicon glyphicon-th-list"></span> Subject Entry Form</h1></div>
<div class="panel-body">
<form method="post">
<div class="container">
<p style="text-align:center;">Here, you'll add new subject's detail to record into database.</p>
</div>
<div class="teacher_bday_box" style="margin-left: 0px;">
<div class="select_style">
<select name="factxt" style="width: 200px;">
<option>Facultie's name</option>
<?php
$fac_name=mysql_query("SELECT * FROM facuties_tbl");
while($row=mysql_fetch_array($fac_name)){
?>
<option value="<?php echo $row['faculties_id'];?>"> <?php echo $row['faculties_name'];?> </option>
<?php
}
?>
</select>
</div>
</div><br><br>
<div class="teacher_bday_box" style="margin-left: 0px;">
<div class="select_style">
<select name="techtxt" style="width: 200px">
<option>Teacher's name</option>
<?php
$te_name=mysql_query("SELECT * FROM teacher_tbl");
while($row=mysql_fetch_array($te_name)){
?>
<option value="<?php echo $row['teacher_id'];?>"> <?php echo $row['f_name'] ; echo " "; echo $row['l_name'];?> </option>
<?php
}
?>
</select>
</div>
</div><br><br>
<div class="teacher_note_pos">
<input type="text" class="form-control" name="semestertxt" id="textbox" placeholder="Semester" />
</div><br>
<div class="teacher_note_pos">
<input type="text" class="form-control" name="subtxt" id="textbox" placeholder="Subject's name"/>
</div><br>
<div class="text_box_pos">
<textarea class="form-control" name="notetxt" cols="23" rows="3" placeholder='Add note..'></textarea>
</div><br><br>
<div>
<input type="submit" class="btn btn-primary btn-large" name="btn_sub" value="Add Now" id="button-in" />
<input type="reset" class="btn btn-primary btn-large" style="margin-left: 9px;" value="Cancel" id="button-in"/>
</div>
</form>
</div>
</form>
</div><!-- end of style_informatios -->
<?php
}
?>
</body>
</html>