-
Notifications
You must be signed in to change notification settings - Fork 0
/
category.php
140 lines (113 loc) · 4.36 KB
/
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
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
<?php
session_start();
require_once "includes/config.php";
/* if(!isset($_SESSION['admin'])){
header('Location: login.php');
} */
if (isset($_POST['submit'])) {
$categorie=htmlspecialchars($_POST['categorie']);
$description=htmlspecialchars($_POST['description']);
$db-> query("INSERT INTO `categorie` VALUES (null, '$categorie', '$description' )");
$insertMsg="Bien ajouté!"; //execute query success message
$_SESSION['msg']= $insertMsg;
//header("refresh:10;index.php"); refresh 10 second and redirect to index.php page
header("refresh:2;category.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>EShop</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="Free HTML Templates" name="keywords">
<meta content="Free HTML Templates" name="description">
<!-- Favicon -->
<link href="img/favicon.ico" rel="icon">
<!-- Google Web Fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet">
<!-- Libraries Stylesheet -->
<link href="lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet">
<!-- Customized Bootstrap Stylesheet -->
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<!-- Topbar Start -->
<!-- Topbar End -->
<!-- Navbar Start -->
<?php
include 'includes/navbarA.php';
?>
<!-- Navbar End -->
<!-- Category Start -->
<div class="container-fluid pt-5">
<div class="text-center mb-4">
<h2 class="section-title px-5"><span class="px-2">Ajouter une catégorie</span></h2>
</div>
<div class="row px-xl-5">
<div class="col-md-4"></div>
<div class="col-md-4 mb-5">
<?php
if(isset($errorMsg))
{
?>
<div class="alert alert-danger alert-dismissible fade show mt-2" role="alert">
<?=$errorMsg?>
</div>
<?php
}
elseif(isset($_SESSION['msg']))
{
?>
<div class="alert alert-success alert-dismissible fade show mt-2" role="alert">
<?=$_SESSION['msg']?>
</div>
<?php
}
unset($_SESSION['msg']);
?>
<form method="post" >
<div class="control-group">
<input name="categorie" type="text" class="form-control" id="name" placeholder="Catégorie"
required="required" data-validation-required-message="Entrer la catégorie!" />
<p class="help-block text-danger"></p>
</div>
<div class="control-group">
<textarea class="form-control" rows="6" id="message" placeholder="Description"
required="required" name="description"
data-validation-required-message="Entrer une description!"></textarea>
<p class="help-block text-danger"></p>
</div>
<div>
<button name="submit" class="btn btn-primary py-2 px-4" type="submit" id="sendMessageButton">
Valider
</button>
</div>
</form>
</div>
<div class="col-md-4"></div>
</div>
</div>
<!-- Products End -->
<!-- Footer Start -->
<?php
include 'includes/footerA.php';
?>
<!-- Footer End -->
<!-- Back to Top -->
<a href="#" class="btn btn-primary back-to-top"><i class="fa fa-angle-double-up"></i></a>
<!-- JavaScript Libraries -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="lib/easing/easing.min.js"></script>
<script src="lib/owlcarousel/owl.carousel.min.js"></script>
<!-- Contact Javascript File -->
<script src="mail/jqBootstrapValidation.min.js"></script>
<script src="mail/contact.js"></script>
<!-- Template Javascript -->
<script src="js/main.js"></script>
</body>
</html>