From 9551399b0802d38197c3f395858cdad7d3f55c37 Mon Sep 17 00:00:00 2001 From: Andrew Malsbury Date: Sat, 7 Oct 2023 16:11:19 +0000 Subject: [PATCH] Update add and edit to accomodate type --- post/account.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/post/account.php b/post/account.php index b598b952..1a5b3a6c 100644 --- a/post/account.php +++ b/post/account.php @@ -10,8 +10,9 @@ if (isset($_POST['add_account'])) { $opening_balance = floatval($_POST['opening_balance']); $currency_code = sanitizeInput($_POST['currency_code']); $notes = sanitizeInput($_POST['notes']); + $type = intval($_POST['type']); - mysqli_query($mysqli,"INSERT INTO accounts SET account_name = '$name', opening_balance = $opening_balance, account_currency_code = '$currency_code', account_notes = '$notes'"); + mysqli_query($mysqli,"INSERT INTO accounts SET account_name = '$name', opening_balance = $opening_balance, account_currency_code = '$currency_code', account_type ='$type', account_notes = '$notes'"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Account', log_action = 'Create', log_description = '$name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); @@ -26,9 +27,10 @@ if (isset($_POST['edit_account'])) { $account_id = intval($_POST['account_id']); $name = sanitizeInput($_POST['name']); + $type = intval($_POST['type']); $notes = sanitizeInput($_POST['notes']); - mysqli_query($mysqli,"UPDATE accounts SET account_name = '$name', account_notes = '$notes' WHERE account_id = $account_id"); + mysqli_query($mysqli,"UPDATE accounts SET account_name = '$name',account_type = '$type', account_notes = '$notes' WHERE account_id = $account_id"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Account', log_action = 'Modify', log_description = '$name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");