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


if(isset($_REQUEST['edit']))
{
    $our_team_top_id = base64_decode($_REQUEST['edit']);
    $ex = $obj->get_our_team_topinfo($our_team_top_id);
    $row = mysqli_fetch_array($ex);
}
if(isset($_POST['update']))
{   
  $our_team_top_info['our_team_top_id'] = $_POST['our_team_top_id'];
  $our_team_top_info['our_board_title'] = $_POST['our_board_title'];
  $our_team_top_info['our_board_desc'] = $_POST['our_board_desc'];
  $our_team_top_info['our_management_title'] = $_POST['our_management_title'];
  $our_team_top_info['our_management_desc'] = str_replace("'","\'", $_POST['our_management_desc']);
    $ex = $obj->update_our_teamtoinfo($our_team_top_info);
    echo '<script>window.location="ourteamtop.php"</script>';
}

if(isset($_POST['submit']))
{
  $our_team_top_info['our_board_title'] = $_POST['our_board_title'];
  $our_team_top_info['our_board_desc'] = $_POST['our_board_desc'];
  $our_team_top_info['our_management_title'] = $_POST['our_management_title'];
  $our_team_top_info['our_management_desc'] = str_replace("'","\'", $_POST['our_management_desc']);

$ex = $obj->insert_our_teamtoinfo($our_team_top_info);
    echo '<script>window.location="ourteamtop.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>Our Team Top Information
                <a href="ourteamtop.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="our_team_top_id" value="<?php echo $row['our_team_top_id'];?>">
                    <h5>Our Board</h5>
                   <div class="form-group">
                  <label>Title</label>
                  <input type="text" class="form-control" name="our_board_title" value="<?php echo $row['our_board_title'];?>">
                  </div>
                  <div class="form-group">
                 <label>Description</label>
                  <textarea id="w3review" name="our_board_desc" rows="6" cols="50" class="tinymce"><?php echo $row['our_board_desc'];?></textarea>
                  </div>
                   <h5>Our Management Team</h5>
                  <div class="form-group">
                  <label>Title</label>
                  <input type="text" class="form-control" name="our_management_title" value="<?php echo $row['our_management_title'];?>">
                  </div>
                  <div class="form-group">
                 <label>Description</label>
                  <textarea id="w3review" name="our_management_desc" rows="6" cols="50" class="tinymce"><?php echo $row['our_management_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 = "ourteamtop.php";
</script>

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

