-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitem_add.php
35 lines (25 loc) · 855 Bytes
/
item_add.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
<?php
session_start();
include 'utilities.php';
if ($_POST["title"] != "" && $_POST["category"] != "") {
$title = filter($_POST["title"]);
if ($_POST["description"] != "") {
$description = filter($_POST["description"]);
} else {
$description = "";
}
$category = filter($_POST["category"]);
if ($title != "" && $category != "") {
//Aggiungo i dati in database
include 'db_class.php';
$my_db = new sql_class;
$my_db->addItem($title, $description, $category);
} else {
$_SESSION["message"] = "Inserimento non eseguito: non puoi usare caratteri speciali.";
$_SESSION["status"] = "danger";
}
} else {
$_SESSION["message"] = "Inserimento non eseguito: servono titolo e categoria.";
$_SESSION["status"] = "danger";
}
header('location: index.php');