-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd-event2.php
26 lines (26 loc) · 1.04 KB
/
add-event2.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
<?php
if (isset($_POST['event-name'])) {
$event = $_POST['event-name'];
include("select-event.php");
$counter = count($subsubcategories);
foreach ($subsubcategories as $subsubcategory) {
foreach ($subsubcategory as $value) {
if ($value != $event) {
$counter--;
}
}
}
if ($counter == 0) {
$db = mysqli_connect("localhost", "root", "root");
mysqli_select_db($db, "wprgmxbet");
$sql = "INSERT INTO sub_sub_category(name) VALUES ('". $event . "')";
if ($db->query($sql) === TRUE) {
echo "<div class='alert alert-success' role='alert'><h3 class='h4 mb-3'>🎈 Pomyślnie dodano wydarzenie!</h3></div>";
} else {
echo "<div class='alert alert-danger' role='alert'><h3 class='h4 mb-3'>❌ Nie udało się dodać wydarzenia</h3></div>";
}
mysqli_close($db);
} else {
echo "<div class='alert alert-danger' role='alert'><h3 class='h4 mb-3'>❌ Podane wydarzenie już istnieje!</h3></div>";
}
}