-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathFaculties_Entry.php
121 lines (97 loc) · 3.42 KB
/
Faculties_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
<?php
$id="";
$opr="";
if(isset($_GET['opr']))
$opr=$_GET['opr'];
if(isset($_GET['rs_id']))
$id=$_GET['rs_id'];
if(isset($_POST['btn_sub'])){
$facuties_name=$_POST['fnametxt'];
$note=$_POST['notetxt'];
$sql_ins=mysql_query("INSERT INTO facuties_tbl
VALUES(
NULL,
'$facuties_name',
'$note'
)
");
if($sql_ins==true)
$msg="1 Row Inserted";
else
$msg="Insert Error:".mysql_error();
}
//------------------uodate data----------
if(isset($_POST['btn_upd'])){
$fac_name=$_POST['fnametxt'];
$note=$_POST['notetxt'];
$sql_update=mysql_query("UPDATE facuties_tbl SET
faculties_name='$fac_name',
note='$note'
WHERE
faculties_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 facuties_tbl WHERE faculties_id=$id");
$rs_upd=mysql_fetch_array($sql_upd);
?>
<div class="panel panel-default">
<div class="panel-heading"><h1><span class="glyphicon glyphicon-hdd"></span> Faculties Update Form</h1></div>
<div class="panel-body">
<div class="container">
<p style="text-align:center;">Here, you'll update the faculties detail to record into database.</p>
</div>
<div class="container_form">
<form method="post">
<div class='faculty_pos'>
<input type="text" style="width: 250px;" class="form-control" name="fnametxt" value="<?php echo $rs_upd['faculties_name'];?>"/><br>
<textarea name="notetxt" class="form-control" cols="18" value='<?php echo $rs_upd['note'];?>' rows="4"></textarea><br><Br>
<input type="submit" name="btn_upd" href="#" class="btn btn-primary btn-large" value="Register" />
<input type="reset" href="#" class="btn btn-primary btn-large" value="Cancel" />
</div>
</form>
</div>
<?php
}
else
{
?>
<div class="panel panel-default">
<div class="panel-heading"><h1><span class="glyphicon glyphicon-hdd"></span> Faculties Entry Form</h1></div>
<div class="panel-body">
<div class="container">
<p style="text-align:center;">Here, you'll add new facultie's detail to record into database.</p>
</div>
<div class="container_form">
<form method="post">
<div class='faculty_pos'>
<input type="text" style="width: 250px;" class="form-control" name="fnametxt" placeholder='Faculties name'/><br>
<textarea name="notetxt" class="form-control" cols="18" placeholder='Add notes..' rows="4"></textarea><br><Br>
<input type="submit" name="btn_sub" href="#" class="btn btn-primary btn-large" value="Register" />
<input type="reset" href="#" class="btn btn-primary btn-large" value="Cancel" />
</div>
</form>
</div><!-- end of style_informatios -->
<?php
}
?>
</body>
</html>