<?php
include_once("../include/main.inc.php");
check_session('MyCpanel', 'index.php');
################ Paging Starts From Here ##################
@extract($_REQUEST);
$start = (intval($start) < 0 or $start == "") ? 0 : $start;
$pagesize = intval($pagesize) == 0 ? $pagesize = 20 : $pagesize;

$heading = "Manage SEO Audit Heading/Text";
$record_type = "SEO Audit Heading/Text";
$script_name = "manage_seo_audit.php";
$table_name = " seo_free_audit_tbl";
####################################################

if ($id == "update_record") {

  $heading1 = htmlentitiesDecode($heading1);
  $heading2 = htmlentitiesDecode($heading2);
  $heading3 = htmlentitiesDecode($heading3);

    updateTable($table_name, " heading1='$heading1',heading2='$heading2',heading3='$heading3',button_name='$button_name',button_link='$button_link',recvDate=now() where id='$recordID'");
    
    $message = '<div class="btn btn-success">' . $record_type . ' has been updated successfully  </div>';

    header("Location: " . SITE_ADMIN_URL . "/" . $script_name . "?recordID=1");
    exit;
  
}

########################################################
admin_header("");
$qry= db_query("select * from $table_name");
?>
<?php
 $res=getResult($table_name," where id='$_GET[recordID]'");
?>
<div class="content-wrapper">
<div class="page-header">
            <h3 class="page-title">Manage SEO Audit Heading/Text</h3>
            <nav aria-label="breadcrumb">
			<ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?admin_url?>welcome.php">Admin</a></li>
                <li class="breadcrumb-item active" aria-current="page">SEO Audit Heading/Text</li>
                </ol>
            </nav>
          </div>
<div class="row">
  
            <div class="col-12 grid-margin stretch-card">
              <div class="card">
                <div class="card-body">
                  <form class="forms-sample" method="POST" action="" enctype="multipart/form-data">
                    <div class="form-group">
                      <label>Heading 1</label>
                        <input class="typeahead" type="text"  name="heading1" value="<?=$res['heading1']?>" placeholder="" required>
                 	</div>
                   <div class="form-group">
                      <label>Heading 2</label>
                        <input class="typeahead" type="text"  name="heading2" value="<?=$res['heading2']?>" placeholder="">
                 	</div>
                   <div class="form-group">
                      <label>Heading 3</label>
                        <input class="typeahead" type="text"  name="heading3" value="<?=$res['heading3']?>" placeholder="">
                 	</div>

    
                   <div class="form-group row">
                   <div class="col">
                      <label>Button Name</label>
                        <input class="typeahead" type="text"  name="button_name" value="<?=$res['button_name']?>" placeholder="">
                     </div>
               
                   <div class="col">
               
                      <label>Button Link</label>
                        <input class="typeahead" type="text"  name="button_link" value="<?=$res['button_link']?>" placeholder="">
                     </div>
                 	  </div>

                  <?php
          if($_GET[recordID] != Null) {
            ?>
            <button type="submit" class="btn btn-primary mr-2" name="add_record">Update </button>
	   		<input type="hidden" name="recordID" value="<?=$res['id'];?>">
	   		<input type="hidden" name="id" value="update_record">
    <?php
          } else {
            ?>
              <button type="submit" class="btn btn-primary mr-2" name="submit">Submit</button>
              <input type="hidden" name="id" value="update_record">
    <?php
          }
          ?>

                 
                  </form>
                </div>
              </div>
            </div>
          </div>
  
    
        </div>
        <script language="javascript">
function select_chk(){
var chks = document.getElementsByName('cat_arr[]');
var hasChecked = false;
for (var i = 0; i < chks.length; i++){
if (chks[i].checked){
  hasChecked = true;
  break;
  }
}
if (hasChecked == false){
alert("Please Select At Least One.");
return false;
}
}
</script>
                  <?php
                  admin_footer();
                  ?>
                  <?php if(isset($message))
                  {?>

                     <script>

                    </script>

                <?php }?>