| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/thelittlebigshow/app.original/Original-DO NOT DELETE/admin/ |
Upload File : |
<?php
session_start();
require_once './config/config.php';
require_once './includes/auth_validate.php';
//serve POST method, After successful insert, redirect to customers.php page.
if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
//Mass Insert Data. Keep "name" attribute in html form same as column name in mysql table.
$data_to_store = array_filter($_POST);
//Insert timestamp
$data_to_store['created_at'] = date('Y-m-d H:i:s');
$db = getDbInstance();
$last_id = $db->insert('customers', $data_to_store);
if($last_id)
{
$_SESSION['success'] = "Customer added successfully!";
header('location: customers.php');
exit();
}
else
{
echo 'insert failed: ' . $db->getLastError();
exit();
}
}
//We are using same form for adding and editing. This is a create form so declare $edit = false.
$edit = false;
require_once 'includes/header.php';
?>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h2 class="page-header">Add Customers</h2>
</div>
</div>
<form class="form" action="" method="post" id="customer_form" enctype="multipart/form-data">
<?php include_once('./forms/customer_form.php'); ?>
</form>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#customer_form").validate({
rules: {
f_name: {
required: true,
minlength: 3
},
l_name: {
required: true,
minlength: 3
},
}
});
});
</script>
<?php include_once 'includes/footer.php'; ?>