<?php
include $_SERVER['DOCUMENT_ROOT'] . "/classes/autoload.php";

if (empty($_POST['supplier_id'])) {
    exit;
}

$supplier_id = $_POST['supplier_id'];

$db = new db();

$res = $db->query(
    "stock",
    "SELECT * FROM stock WHERE supplier_id = '{$supplier_id}'"
);

while ($row = $res->fetch_assoc()) {
    echo "<option>{$row['code']}~{$row['name']}~{$row['unit_of_measure']}~{$row['retail']}</option>";
}
