<?php
session_start();

if (!isset($_SESSION['userID'])) {
    header("Location: sign-in.php");
    exit();
}
require_once "SqlConnection/MySqlConnection.php";
$invoiceNumber = $_POST['invoiceNumber'];
$sql = "Delete from invoicestable where invoiceNumber='".$invoiceNumber."';Delete from invoices where invoiceNumber='".$invoiceNumber."'";
$result = mysqli_multi_query($conn,$sql);
if($result){
    header("Location: invoicesData.php");
}
else{
    echo "Error while deleting customer";
}
?>