<?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 Company Factsheet";
$record_type = "Company Factsheet";
$script_name = "manage_company_factsheet.php";
$table_name = "factsheet_tbl";
####################################################

if ($id == "update_record") {

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

    updateTable($table_name, " heading1='$heading1',heading2='$heading2',heading3='$heading3',heading4='$heading4', recvDate=now()");
    
    $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);
?>
<div class="content-wrapper">
<div class="page-header">
            <h3 class="page-title">Manage Company Factsheet</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">Manage Company Factsheet</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>Established on </label>
                        <input class="typeahead" type="text"  name="heading1" value="<?=$res['heading1']?>" placeholder="" required>
                 	</div>
                   <div class="form-group">
                      <label>Clients Trust Us</label>
                        <input class="typeahead" type="text"  name="heading2" value="<?=$res['heading2']?>" placeholder="">
                 	</div>
                   <div class="form-group">
                      <label>Branche Locations</label>
                        <input class="typeahead" type="text"  name="heading3" value="<?=$res['heading3']?>" placeholder="">
                 	</div>
                   <div class="form-group">
                      <label>Award Wins</label>
                        <input class="typeahead" type="text"  name="heading4" value="<?=$res['heading4']?>" placeholder="">
                 	</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();
                  ?>
                 