| Linux premium274.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64 Path : /home/whagcoha/ledger.mwagalwaservices.com/ |
| Current File : /home/whagcoha/ledger.mwagalwaservices.com/categories.php |
<?php
if ((!isset($_SESSION['gen256'])) ) {
echo "<script>
window.open('login.php','_self');
</script>";
}
?>
<?php
$user_id = $_SESSION['gen256']['id'];
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['category_name'])) {
$stmt = $conn->prepare("INSERT INTO categories (name, user_id) VALUES (?, ?)");
$stmt->bind_param("si", $_POST['category_name'], $user_id);
$stmt->execute();
echo '<div class="alert alert-success">Category added successfully!</div>';
}
?>
<div class="card p-3 shadow-sm">
<h5 class="mb-3">Add Expense Category Type</h5>
<form method="POST">
<div class="mb-3">
<label class="form-label">Category Type</label>
<input type="text" class="form-control" name="category_name" placeholder="Enter category name" required>
</div>
<button type="submit" class="btn btn-primary w-100">Save Category</button>
</form>
</div>
<div class="alert alert-info">
<strong>Note:</strong> No Need To Regularly update This. This section lets you add custom categories for your Expenses.
When recording new Expense, these categories will appear in a dropdown so you can
easily organize and track where your money is coming from.
</div>