<?php
include_once("../include/main.inc.php");
check_session('MyCpanel', 'index.php');

@extract($_REQUEST);
$heading = "Manage Advance Payment";
$res = getResult("admin_details", " where user_type='admin'");

$record_type = "Advance payment";
$script_name = "advance_payment.php";
$redirect_script_name = "advance_payment.php";
$table_name = "category_tbl";
#################### Add Record ##################

################ Update Record ##################
$error = '';
if ($_REQUEST['action'] == "update_record") {
    if(ctype_digit($catprice)){
        updateTable($table_name, " catprice='$catprice' where catID=24");
        $error = '<div class="alert alert-success text-center">Updated Successfully!</div>';
    }else{
        $error = '<div class="alert alert-danger text-center">Enter valid amount value !</div>';

    }
}
########################################################
admin_header();
$res = getResult($table_name, " where catID=24");
?>
<div class="content-wrapper">
    <div class="page-header">
        <h3 class="page-title"><?= $heading; ?></h3>
        <nav aria-label="breadcrumb">
		    <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?= admin_url ?>">Admin</a></li>
                <li class="breadcrumb-item active" aria-current="page"><?= $heading ?></li>
            </ol>
        </nav>
        
    </div>
    <div class="row">
        <div class="col-12 grid-margin stretch-card">
            
            <div class="card">
                <div class="card-body">
                    <div><?= $error; ?></div>
                    <form class="forms-sample" method="post" action="" enctype="multipart/form-data"
                        onsubmit="return validate(this);">
                        <div class="form-group row">
                            <div class="col">
                                <label>Manage Advance payment</label>
                                <div id="the-basics">
                                    <input class="typeahead" type="number" name="catprice"
                                        value="<?= $res['catprice'] ?>" placeholder="Price">
                                </div>
                            </div>
                        </div>
                        
                        <button type="submit" class="btn btn-primary mr-2" name="update_record">Update</button>
                        <input type="hidden" name="action" value="update_record">
                </div>
            </div>
        </div>
    </div>
</div>
<!-- content-wrapper ends -->
<?php
admin_footer();
exit;
?>