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


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

  $aboutdetails_info['about_details_top'] = str_replace("'","\'", $_POST['about_details_top']);
  $aboutdetails_info['about_details_bottom'] = str_replace("'","\'", $_POST['about_details_bottom']);
     
    $ex = $obj->update_aboutdetails_info($aboutdetails_info);
    echo '<script>window.location="aboutus_details.php"</script>';
}

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


  $aboutdetails_info['about_details_top'] = str_replace("'","\'", $_POST['about_details_top']);
  $aboutdetails_info['about_details_bottom'] = str_replace("'","\'", $_POST['about_details_bottom']);
  
   $ex = $obj->insert_aboutdetails_info($aboutdetails_info);
    echo '<script>window.location="aboutus_details.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>About Us Details
                <a href="aboutpage.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="about_details_id" value="<?php echo $row['about_details_id'];?>">
                  <div class="form-group">
                 <label>About Page Description</label>
                  <textarea id="w3review" name="about_details_top" rows="6" cols="50" class="tinymce"><?php echo $row['about_details_top'];?></textarea>
               </div>
                <div class="form-group">
                 <label>Description</label>
                  <textarea id="w3review" name="about_details_bottom" rows="6" cols="50" class="tinymce"><?php echo $row['about_details_bottom'];?></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 = "aboutus_details.php";
</script>

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

