12345678910111213141516 |
- <?php
-
- require_once 'config.php';
- require_once 'dbh.inc.php';
- require_once 'checkLogin.php';
-
- // IF USER ENTERS PAGE AFTER 'Save' BUTTON HAS BEEN PRESSED (FROM categories.php), INSERT CATEGORY TO DATABASE
- // ELSE (IF USER ENTERED THIS PAGE WITHOUT SUBMITING A FORM) REDIRECT TO categories.php
- if(isset($_POST['insertCategory'])) {
- $categoria = mysqli_real_escape_string($connection, $_POST['categoria']);
- $query = "INSERT INTO `category` (categoria) VALUES ('".$categoria."');";
- if(!mysqli_query($connection, $query)) die("Error: ".mysqli_error($connection));
- }
-
- header('Location: ../categories.php');
- exit();
|