<?php
include "db.class.php";
$db = new DBMain();

$data = $_POST;

$indexes = array_keys($data);
$keys = "`" . implode("`,`", $indexes) . "`";
$index_data = array_values($data);
$index_data = str_replace("'", " ", $index_data);
$all_data = "'" . implode("','", $index_data) . "'";

echo "INSERT INTO `jobcards` ($keys) VALUES ($all_data)";

$save = $db->insert("INSERT INTO `jobcards` ($keys) VALUES ($all_data)");
if ($save) {
    echo "success";
    // echo "<script>window.location.href = 'index.php';</script>";
} else {
    echo "<br><br><br>failed to save";
}
