Repository navigation
Expand file tree
/
Copy pathcreate_dept.php
More file actions
62 lines (51 loc) · 1.73 KB
/
Copy pathcreate_dept.php
File metadata and controls
62 lines (51 loc) · 1.73 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<title>dept. creation</title>
</head>
<body>
<div class = "container">
<div>
<h2>create Dept.</h2>
</div>
<div class = "col-md-7">
<form method="post" action="create_dept.php">
<div class="form-group">
<label for="">Dept. Name</label>
<input type="text" class="form-control" name="name" id="">
</div>
<div class="form-group">
<label for="">dept. short code</label>
<input type="text"class="form-control" name="scode" id="">
</div>
<div class="form-group">
<label for="">Dept. code</label>
<input type="text" class="form-control" name="code" id="">
</div>
<div class="form-group">
<input type="submit" name="submit" class="btn btn-primary" value="add dept.">
</div>
</form>
</div>
</div>
</body>
</html>
<?php
include 'connection.php';
if(isset($_POST['submit']))
{
//recvd data from input/control.
$name = $_POST['name'];
$scode = $_POST['scode'];
$code = $_POST['code'];
//db query
$query = "INSERT INTO departments(name, short_code, code) VALUES ('$name','$scode','$code')";
if(mysqli_query($conn, $query))
{
echo "success!!";
}
}
?>