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


if(isset($_REQUEST['edit']))
{
    $lf_at_ethics_id = base64_decode($_REQUEST['edit']);
    $ex = $obj->get_datafrom_id_wise($lf_at_ethics_id);
    $row = mysqli_fetch_array($ex);
}
if(isset($_POST['update']))
{   
    $update_lf_at_ethics['life_at_ethics_id'] = $_POST['life_at_ethics_id'];
    $update_lf_at_ethics['life_at_ethics_title'] = $_POST['life_at_ethics_title'];
	$ex = $obj->update_lf_at_ethics_cat($update_lf_at_ethics);
    echo '<script>window.location="life-category.php"</script>';
}

if(isset($_POST['submit']))
{
	$lf_info['life_at_ethics_title'] = $_POST['life_at_ethics_title'];
	
    $ex = $obj->add_life_at_ethics_cat($lf_info);
    echo '<script>window.location="life-category.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>Add Life At Ethics Category
                <a href="life-category.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="life_at_ethics_id" value="<?php echo $lf_at_ethics_id;?>">
                    
                    
					
					<div class="form-group">
                        <label>Life Ethics Category</label>
                        <input type="text" class="form-control" name="life_at_ethics_title" required value="<?php echo $row['life_at_ethics_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 = "life-category.php";
</script>

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

