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


if(isset($_REQUEST['edit']))
{
    $seo_meta_id = base64_decode($_REQUEST['edit']);
    $ex = $obj->get_seometa_page_id($seo_meta_id);
    $row = mysqli_fetch_array($ex);
}
if(isset($_POST['update']))
{   
    $update_seo['seo_meta_id'] = $_POST['seo_meta_id'];
    $update_seo['seo_meta_page'] = $_POST['seo_meta_page'];
	$update_seo['seo_meta_url'] = $_POST['seo_meta_url'];
    $update_seo['seo_meta_title'] = $_POST['seo_meta_title'];
    $update_seo['seo_meta_description'] = $_POST['seo_meta_description'];
    $update_seo['seo_meta_keyword'] = $_POST['seo_meta_keyword'];
    $update_seo['seo_meta_extrabox'] = $_POST['seo_meta_extrabox'];
    
    $ex = $obj->update_seo_meta($update_seo);
    echo '<script>window.location="metainfo.php"</script>';
}

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

$row['seo_meta_page'] = $_POST['seo_meta_page'];
$row['seo_meta_url'] = $_POST['seo_meta_url'];
$row['seo_meta_title'] = $_POST['seo_meta_title'];
$row['seo_meta_description'] = $_POST['seo_meta_description'];
$row['seo_meta_keyword'] = $_POST['seo_meta_keyword'];
$row['seo_meta_extrabox'] = $_POST['seo_meta_extrabox'];

    $ex = $obj->add_seo_meta_info($row);
    echo '<script>window.location="metainfo.php"</script>';
}

?>
<style>
textarea {
    overflow: auto;
    resize: vertical;
    width: 100%;
}
</style>

<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>Meta info
                <a href="metainfo.php" class="btn btn-primary btn-sm float-right">Back</a>
            </div>
            <div class="card-body">
                <form method="post" name="frm">
                   <input type="hidden" name="seo_meta_id" value="<?php echo $row['seo_meta_id'];?>">
                    
                  
                    <div class="form-group">
                 <label>Page Name</label>
                        <input type="text" class="form-control" name="seo_meta_page" value="<?php echo $row['seo_meta_page'];?>">
               </div>

                  
                     <div class="form-group">
                  <label>Page URL</label>
                  <input type="text" class="form-control" name="seo_meta_url" value="<?php echo $row['seo_meta_url'];?>">
               </div>
                <div class="form-group">
                  <label>Meta title</label>
                  <input type="text" class="form-control" name="seo_meta_title" value="<?php echo $row['seo_meta_title'];?>">
               </div>
          
          <div class="form-group">
                        <label>Meta Description</label>
                        <textarea id="w3review" name="seo_meta_description" rows="6" cols="50"><?php echo $row['seo_meta_description'];?></textarea>
           </div>
           <div class="form-group">
                        <label>Meta Keyword</label>
                        <textarea id="w3review" name="seo_meta_keyword" rows="6" cols="50"><?php echo $row['seo_meta_keyword'];?></textarea>
           </div>
		   <div class="form-group">
                        <label>Megic Box</label>
                        <textarea id="w3review" name="seo_meta_extrabox" rows="6" cols="50"><?php echo $row['seo_meta_extrabox'];?></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 = "metainfo.php";
</script>

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

