Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /category.php on line 14
Fatal error: Uncaught Error: Call to a member function error() on null in category/category.php:20 Stack trace: #0 {main} thrown in category/category.php on line 20
<?php
session_start();
mysqli_report(E_ALL);
if(!isset($_SESSION['loggedin'])){
header('location : ../../connection/session.php');
exit();
}
if(isset($_POST["submit"])){
if(empty($_POST['name'])){
echo "some fields are empty";
}else{
$names = $_POST['name'];
$result= mysqli_query($link,"insert into category(name) values('$name')");
if($result){
echo "added successfully";
header('location:create.php');
}else{
echo "error".$link->error();
}
}
}