mescole update
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
include('include/headscript.php');
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$supplier_name = trim($_POST['supplier_name'] ?? '');
|
||||
$vat = trim($_POST['vat'] ?? '');
|
||||
|
||||
if ($supplier_name === '') {
|
||||
echo json_encode(['success' => false, 'message' => 'Supplier name required']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$db = DBHandlerSelect::getInstance();
|
||||
$pdo = $db->getConnection();
|
||||
|
||||
$stmt = $pdo->prepare("INSERT INTO suppliers (supplier_name, vat) VALUES (?, ?)");
|
||||
$ok = $stmt->execute([$supplier_name, $vat !== '' ? $vat : null]);
|
||||
|
||||
echo json_encode(['success' => (bool)$ok]);
|
||||
Reference in New Issue
Block a user