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


if(isset($_REQUEST['edit']))
{
    $int_mgt_sys_id = base64_decode($_REQUEST['edit']);
    $ex = $obj->get_integration_mgt_sys($int_mgt_sys_id);
    $row = mysqli_fetch_array($ex);
}
if(isset($_POST['update']))
{   

  $int_mgt_sys_info['int_mgt_sys_id'] = $_POST['int_mgt_sys_id'];
  $int_mgt_sys_info['int_mgt_sys_title'] = str_replace("'","\'", $_POST['int_mgt_sys_title']);
  $int_mgt_sys_info['int_mgt_sys_desc'] = str_replace("'","\'", $_POST['int_mgt_sys_desc']);
  
        
       
    $ex = $obj->update_integration_mgtsys($int_mgt_sys_info);
    echo '<script>window.location="integration_mgt_sys.php"</script>';
}

if(isset($_POST['submit']))
{

   $int_mgt_sys_info['int_mgt_sys_title'] = str_replace("'","\'", $_POST['int_mgt_sys_title']);
   $int_mgt_sys_info['int_mgt_sys_desc'] = str_replace("'","\'", $_POST['int_mgt_sys_desc']);

  $ex = $obj->insert_integration__mgtsys($int_mgt_sys_info);
    echo '<script>window.location="integration_mgt_sys.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>Integration Page Content
                <a href="integration_mgt_sys.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="int_mgt_sys_id" value="<?php echo $row['int_mgt_sys_id'];?>">
                   

                  <div class="form-group">
                        <label>Title</label>
                        <input type="text" name="int_mgt_sys_title" class="form-control" value="<?php echo $row['int_mgt_sys_title'];?>">
                   </div>
                    <div class="form-group">
                        <label>Description</label>
                        <textarea id="w3review" name="int_mgt_sys_desc" rows="6" cols="50" class="tinymce"><?php echo $row['int_mgt_sys_desc'];?></textarea>
                      </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 = "integration_mgt_sys.php";
</script>

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

