<?php
require_once("header.php");
require_once("menu.php");


if(isset($_REQUEST['edit']))
{
    $id = base64_decode($_REQUEST['edit']);
    $ex = $obj->get_qp_commited_id($id);
    $row = mysqli_fetch_array($ex);
}
if(isset($_POST['update']))
{   
    $update_qpc['id'] = $_POST['id'];
    $update_qpc['title'] = $_POST['title'];
	 
       
     
    $ex = $obj->update_qp_commited($update_qpc);
    echo '<script>window.location="quality_policy_commited.php"</script>';
}

if(isset($_POST['submit']))
{
	$qpc['title'] = $_POST['title'];
	
    $ex = $obj->insert_qp_commited($qpc);
    echo '<script>window.location="quality_policy_commited.php"</script>';
}

?>

<div id="layoutSidenav_content">
<main class="mt-4">
    <div class="container-fluid">
        
        <div class="card mb-4">
            <div class="card-header">
                <i class="fas fa-check-square mr-1"></i>Quality Policy Commited
                <a href="quality_policy_commited.php" class="btn btn-primary btn-sm float-right">Back</a>
            </div>
            <div class="card-body">
                <form method="post" name="frm" id="frm" enctype="multipart/form-data">
                   <input type="hidden" name="id" value="<?php echo $id;?>">
                    
                    
					
					<div class="form-group">
                        <label>Points</label>
                        <input type="text" class="form-control" name="title" required value="<?php echo $row['title'];?>">
                    </div>
					
                    <?php if(isset($_REQUEST['edit']))
                    { ?> 
                        <button type="submit" class="btn btn-primary" name="update">Update</button>
                    <?php } 
                    else
                    { ?>
                        <button type="submit" class="btn btn-primary" name="submit">Submit</button>
                    <?php } ?>
                </form> 
            </div>
        </div>
    </div>
</main>

<script>
    var url = "update_qpc.php";
</script>

<?php require_once("footer.php");?>

