count("locations") == 0 || $database->count("categories") == 0) { header('Location: app.php?page=items&msg=noloccat'); die(); } $itemdata = [ 'text1' => '', 'qty' => '']; if (!empty($VARS['id'])) { if ($database->has('items', ['itemid' => $VARS['id']])) { $itemdata = $database->select( 'items', [ 'name', 'qty', ], [ 'itemid' => $VARS['id'] ])[0]; } else { // item id is invalid, redirect to a page that won't cause an error when pressing Save header('Location: app.php?page=addstock'); die(); } } ?>

build("adding stock", ['item' => "" . htmlspecialchars($itemdata['name']) . ""]); ?>

'; } else { echo ''; } ?>