-
Notifications
You must be signed in to change notification settings - Fork 1
/
add_category.php
55 lines (51 loc) · 1.66 KB
/
add_category.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
<?php
include('top_header.php');
echo "<title>Add Category</title>";
include('connection.php');
include('header.php');
?>
<h1>Add Category</h1>
<center>
<div class="box-Items col-md-6 col-sm-12">
<form action="add_category.php" method="post" enctype='multipart/form-data'>
<div class="form-group row">
<label for="inputproductname" class="col-sm-4 col-form-label">Category Name</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="inputfoodname" name="categoryname">
</div>
</div>
<div class="form-group row">
<label for="inputquaitity" class="col-sm-4 col-form-label">Category Description</label>
<div class="col-sm-8">
<textarea class="form-control" id="inputquaitity" name="category_description" style="height:150px;"></textarea>
</div>
</div>
<div class="form-group row">
<div class="col-6 ">
<button type="reset" name="reset" class="btn btn-primary " >Reset</button>
</div>
<div class="col-6 ">
<button type="submit" name="submit" class="btn btn-primary">Add category</button>
</div>
</div>
</form>
<?php
if(isset($_POST['submit']))
{
$categoryname=$_POST['categoryname'];
$category_description=$_POST['category_description'];
$query="INSERT INTO category (category_name,category_description ) VALUES ('$categoryname','$category_description')";
$result=mysqli_query($conn,$query);
if(!$result)
die ('data not inserted..!'.mysqli_error($conn));
else
echo "category is inserted Successfully...!";
}
?>
</div>
</center>
<?php
include("footer.php");
?>
</body>
</html>