-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddCategory.php
79 lines (63 loc) · 2.14 KB
/
AddCategory.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
<?php
$conn = mysqli_connect('localhost', 'root', '12345', 'crms');
if (isset($_POST['bclkcategory'])) {
$Catname = $_POST['CategoryName'];
$Catno = $_POST['CategoryNumber'];
$Catsen = $_POST['Sentence'];
// database insert SQL code
$sql = "INSERT INTO `categories` (`Catno`, `Catname`, `Catsen`) VALUES('$Catno', '$Catname', '$Catsen')";
$rs = mysqli_query($conn, $sql);
if (!$rs) {
echo mysqli_error($conn);
} else {
header("Location: Categories.php");
}
}
mysqli_close($conn);
?>
<!DOCTYPE html>
<html lang="en">
<?php include('header.html'); ?>
<?php include('AddCategory.html'); ?>
<div class="form">
<form method="POST" action="AddCategory.php">
<div class="contain">
<span id="title">
<h1>Add Category</h1>
<p>Please fill the details of the new category</p>
</span>
<hr>
<label for="Category Number"><b>Category Number: </b></label>
<input type="text" placeholder="Enter Category Number" name="CategoryNumber" id="Catno" required>
<br>
<label for="Category Name"><b>Category Name: </b></label>
<input type="text" placeholder="Enter Name of Category" name="CategoryName" id="Catname" required>
<br>
<label for="Sentence"><b>Jail Sentence: </b></label>
<input type="text" placeholder="Enter Length of Sentence" name="Sentence" id="Catsen" required>
<br>
<a class=" button-1 btn btn-success btn-lg" href="Categories.php" role="button">Go Back</a>
<button class=" button-1 btn btn-success btn-lg" value="Save" name="bclkcategory">Save</button>
</div>
</form>
</div>
</body>
</html>