<?php

session_start();
include_once "shikanisha.kts.php";

if (isset($_POST['expense'])) {
    $name = ($_POST['expense_type']);
    $amount = ($_POST['amount']);
    date_default_timezone_set("Africa/Nairobi");
   $date = date('Y-m-d H:i:s');


    $sql = "INSERT INTO expenses (expense_name, expense_amount, date_incurred) VALUES ('$name', '$amount', '$date')";
    if (mysqli_query($conn, $sql)) {
       
        header("location: ../expenses.php");
        exit();
    } else {
        echo "Error: " . $sql . "<br>" . mysqli_error($conn);
    }
}
?>
