Server : LiteSpeed
System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64
User : outerorb ( 1091)
PHP Version : 8.1.34
Disable Function : mail
Directory :  /home2/outerorb/dev.outerorbittech.com/oot/admin/

📁 Create New:
⬆️ Upload File:
Current Dir [ Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: addeditcategory.php

Path: /home2/outerorb/dev.outerorbittech.com/oot/admin/addeditcategory.php

Size: 54.02 KB

Permissions: 0644

<?php
// error_reporting(0);

//  ini_set('display_errors', 1);
//  ini_set('display_startup_errors', 1);
//  error_reporting(E_ALL);
include_once("../include/main.inc.php");
check_session('MyCpanel', 'index.php');

@extract($_REQUEST);
if (empty($catID)) {
  $heading = "Add New Category";
} else {
  $heading = "Edit Category";
}
$res = getResult("admin_details", " where user_type='admin'");

$record_type = "New Category";
$script_name = "addeditcategory.php";
$redirect_script_name = "manage-category.php";
$table_name = "category_tbl";
#################### Add Record ##################
if(isset($id)){
  $id=$id;
}else{
  $id='';
}
if ($id == 'remove_image') {
  mysqli_query($dbconn, "UPDATE $table_name SET $field='' where catID = '$catID'");
  // $_SESSION['session_message'] = $record_type . ' has been updated successfully'; 
  header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
  exit;
}

if ($action == "add_record" && $catname != "") {
  // print_r($_FILES);die;
  // print_r($_POST);die;
 
  // $numCnt = getCount($table_name, " where catName='$catname' and parentID='$parentID' and catID!='$catID' and catgType='$catgType' ");
  $numCnt = getCount($table_name, " where catName='$catname' and parentID='$parentID'");
  if ($numCnt > 0) {
    $_SESSION['session_message'] = '<div class="btn btn-warning">' . $record_type . ' already exist  </div>';
  } else {
    if ($_FILES['image']['name'] != " ") {
      $file_extension = strtolower(getExtension($_FILES['image']['name']));
      if ($_FILES['image']['name'] != "") {
        $cat = str_replace(" ", "-", $catname);
        $img_name = $cat;
        $img = upload_file($img_name, "image", "uploaded-files/category/images");
      }
    }else{
      $img='';
    }
    if (isset($_FILES['catIcon'])) {
      if($_FILES['catIcon']['name'] != " ")
      $file_extension = strtolower(getExtension($_FILES['catIcon']['name']));
      if ($_FILES['catIcon']['name'] != "") {
        $cat1 = str_replace(" ", "-", $catname);
        $img_name1 = $cat1;
        $img1 = upload_file($img_name1, "catIcon", "uploaded-files/category/caticon");

        $width = "242";
        $height = "242";

        $source_folder = SITE_DIR_PATH . "/uploaded-files/category/caticon";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/category/caticon/thumbs/";
        // saveResizedPhoto($img1, $width, $height, $source_folder, $destination_folder);
      }
    }else{
      $img1='';
    }


    if ($_FILES['header_icon_image']['name'] != " ") {
      $file_extension = strtolower(getExtension($_FILES['header_icon_image']['name']));
      if ($_FILES['header_icon_image']['name'] != "") {
        $cat1 = str_replace(" ", "-", $catname);
        $img_name1 = $cat1 . uniqid();
        $img1 = upload_file($img_name1, "header_icon_image", "uploaded-files/category/caticon");

        $width = "50";
        $height = "50";

        $source_folder = SITE_DIR_PATH . "/uploaded-files/category/caticon";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/category/caticon/thumbs/";
        saveResizedPhoto($img1, $width, $height, $source_folder, $destination_folder);
      }
    }else{
      $img1='';
    }


    if ($_FILES['cat_home_image']['name'] != " ") {
      $file_extension = strtolower(getExtension($_FILES['cat_home_image']['name']));
      if ($_FILES['cat_home_image']['name'] != "") {
        $cat1 = str_replace(" ", "-", $catname);
        $img_name1 = $cat1 . uniqid();
        $img2 = upload_file($img_name1, "catIcon", "uploaded-files/category/images");

        //Thumb Cut
        $width = "242";
        $height = "242";

        $source_folder = SITE_DIR_PATH . "/uploaded-files/category/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/category/images/thumbs/";
        // saveResizedPhoto($img2, $width, $height, $source_folder, $destination_folder);
      }
    }else{
      $img2='';
    }

    if ($_FILES['catHeadingImage']['name'] != " ") {
      $file_extension = strtolower(getExtension($_FILES['catHeadingImage']['name']));
      if ($_FILES['catHeadingImage']['name'] != "") {
        $cat1 = str_replace(" ", "-", $catname);
        $img_name1 = $cat1 . uniqid();
        $img3 = upload_file($img_name1, "catHeadingImage", "uploaded-files/category/images");

        //Thumb Cut
        $width = "636";
        $height = "380";

        $source_folder = SITE_DIR_PATH . "/uploaded-files/category/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/category/images/thumbs/";
        saveResizedPhoto($img3, $width, $height, $source_folder, $destination_folder);
      }
    }else{
      $img3='';
    }

    $maxRes = mysqli_fetch_array(mysqli_query($dbconn, "select max(catOrder) from `$table_name` where parentID='$parentID'"));
    $catOrder = $maxRes[0] + 1;
    if($is_redirect == ''){
      $is_redirect=0;
    }
    // print_r($is_redirect);die;
  
    // $sql = mysqli_query($GLOBALS['dbconn'], "insert into `$table_name` set parentID='$parentID',catName='" . $catname . "',catUrl='" . $catUrl . "',displayName='" . $catDname . "',catDesc='" . $shortdesc . "',catDesc1='" . $fulldesc . "',catImage='" . $img."',cat_home_image='$img2',catOrder='$catOrder',catIcon='$img1',heading1='" . $heading1 . "',heading2='" . $heading2 . "',heading3='" . $heading3 . "',pageTitle='" . $metatitle . "',pageKeywords='" . $metakeyword . "',pageDescription='" . $metadesc . "',alt='" . $alt . "',title='" . $title . "',is_redirect='" . $is_redirect . "',redirect_link='" . $redirect_link . "',header_icon_image='" . $header_icon_image . "',catHeading1='$catHeading1',catHeading2='$catHeading2',catHeading3='$catHeading3',catHeadingButton='$catHeadingButton',catHeadingLink='$catHeadingLink',catHeadingImage='$img3',
    // catHeadingImageAlt='$catHeadingImageAlt',catHeadingImageTitle='$catHeadingImageTitle'"); 
    $sql=mysqli_query($dbconn,"insert into `$table_name` set parentID='$parentID',catName='" . $catname . "',catUrl='" . $catUrl . "',displayName='" . $catDname . "',catDesc='" . $shortdesc . "',catDesc1='" . $fulldesc . "',catImage='" . $img."',cat_home_image='$img2',catOrder='$catOrder',catIcon='$img1',heading1='" . $heading1 . "',heading2='" . $heading2 . "',heading3='" . $heading3 . "',keyword1='" . $keyword1 . "',keyword2='" . $keyword2 . "',keyword3='" . $keyword3 . "',pageTitle='" . $metatitle . "',pageKeywords='" . $metakeyword . "',pageDescription='" . $metadesc . "',alt='" . $alt ."',title='" . $title ."',is_redirect='" . $is_redirect . "',redirect_link='" . $redirect_link . "',header_icon_image='" . $header_icon_image . "',catHeading1='$catHeading1',catHeading2='$catHeading2',catHeading3='$catHeading3',catHeadingButton='$catHeadingButton',catHeadingLink='$catHeadingLink',catHeadingImage='$img3',catHeadingImageAlt='$catHeadingImageAlt',catHeadingImageTitle='$catHeadingImageTitle'");

    $maxRess = mysqli_fetch_array(mysqli_query($dbconn, "select max(catID) from `$table_name`"));
    $categ_id = $maxRess[0] + 1;
    // echo $categ_id;die;
    $multiCatimage=$_FILES['m_image'];
    // echo "<pre>";print_r($multiCatimage);die;
    if ($multiCatimage != " ") {
      foreach ($multiCatimage['name'] as $key => $image_name) {
        $_FILES['multi']['name'] = $image_name;
        $_FILES['multi']['type'] = $multiCatimage['type'][$key];
        $_FILES['multi']['tmp_name'] = $multiCatimage['tmp_name'][$key];
        $_FILES['multi']['error'] = $multiCatimage['error'][$key];
        $_FILES['multi']['size'] = $multiCatimage['size'][$key];
        $cat1 = str_replace(" ", "-", $catname);
        $img_name1 = $cat1 . time() . '_' . $key;
        $path = upload_file($img_name1, "multi", "uploaded-files/category/images");
        //  print_r($path); die;
        // $width = "636";
        // $height = "380";

        // $source_folder = SITE_DIR_PATH . "/uploaded-files/category/images";
        // $destination_folder = SITE_DIR_PATH . "/uploaded-files/category/images/thumbs/";
        // saveResizedPhoto($path, $width, $height, $source_folder, $destination_folder); 
        if($path != ''){
            $data2['path'][] = $path;
        }
      }
      // print_r($data2['path']);die;
      foreach($data2['path'] as $key=>$val){
        // $sql = mysqli_query($GLOBALS['dbconn'], "insert into `categoryImage` set cat_id='$categ_id','categ_image'='$val'");
        $stmt = $dbconn->prepare("INSERT INTO categoryImage (cat_id, categ_image) VALUES (?, ?)");
        $stmt->bind_param("is", $categ_id, $val);
        $stmt->execute();

        // echo "insert into `categoryImage` set cat_id='$categ_id','categ_image'='$val"; die;
      }
    }


 $_SESSION['session_message'] = '<div class="btn btn-success">' . $record_type . ' has been added successfully  </div>';
    header("Location: " . SITE_ADMIN_URL . "/" . $redirect_script_name . "?start=" . $start . "&parentID=" . $parentID . "&catID=" . $catID . "&pagesize=" . $pagesize);
    exit;
  }
}
################ Update Record  ##################

if ($action == "update_record" && $catname != "") {


  if ($catUrl != $catOldUrl) {
    $catOldUrlUp = $catOldUrl;
  } else {
    $catOldUrlUp = $catOldUrlCheck;
  }

  $numCnt = getCount($table_name, " where catName='$catname' and parentID='$parentID' and catID!='$catID' and catgType='$catgType'");
  if ($numCnt > 0) {
    $_SESSION['session_message'] = '<div class="btn btn-warning">' . $record_type . ' already exist  </div>';
    header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
    exit;
  }

  if ($_FILES['image']['name'] != "") {
    $file_extension = strtolower(getExtension($_FILES['image']['name']));
    if ($file_extension != "jpg" && $file_extension != "gif" && $file_extension != "jpeg" && $file_extension != "png" && $file_extension != "webp") {
      $_SESSION['session_message'] = '<div class="btn btn-warning"> Please upload image (.jpg,.gif,.png,.webp Format Only) </div>';
      header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
      exit;
    }
    if ($_FILES['image']['name'] != "") {
      $categoryRes = getResult($table_name, " where catID='$catID'", "catImage");
      $filename = $categoryRes['catImage'];
      if ($filename != "") {
        $file = site_url . "/uploaded-files/category/images/" . $filename;
        if (file_exists($file)) {
          unlink($file);
        }

        $file_thumb = site_url . "/uploaded-files/category/images/thumbs/" . $filename;
        if (file_exists($file_thumb)) {
          unlink($file_thumb);
        }
      }
      $cat = str_replace(" ", "-", $catname);
      $img_name = $cat;
      $img = upload_file($img_name, "image", "uploaded-files/category/images");
      updateTable($table_name, " catImage='$img' where catID='$catID'");
    }
  }

  if ($_FILES['catIcon']['name'] != "") {
    $file_extension = strtolower(getExtension($_FILES['catIcon']['name']));
    if ($file_extension != "jpg" && $file_extension != "gif" && $file_extension != "jpeg" && $file_extension != "png" && $file_extension != "webp") {
      $_SESSION['session_message'] = '<div class="btn btn-warning"> Please upload image (.jpg,.gif,.png,.webp Format Only) </div>';
      header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
      exit;
    }
    if ($_FILES['catIcon']['name'] != "") {
      $categoryRes = getResult($table_name, " where catID='$catID'", "catIcon");
      $filename = $categoryRes['catIcon'];
      if ($filename != "") {
        $file = site_url . "/uploaded-files/category/caticon/" . $filename;
        if (file_exists($file)) {
          unlink($file);
        }
      }
      $cat = str_replace(" ", "-", $catname);
      $img_name = $cat;
      $img1 = upload_file($img_name, "catIcon", "uploaded-files/category/caticon");
      if ($catID == 7) {
        $width = "221";
        $height = "417";
        $source_folder = SITE_DIR_PATH . "/uploaded-files/category/caticon";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/category/caticon/thumbs/";
        saveResizedPhoto($img1, $width, $height, $source_folder, $destination_folder);
      } else {
        $width = "281";
        $height = "284";
        $source_folder = SITE_DIR_PATH . "/uploaded-files/category/caticon";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/category/caticon/thumbs/";
        saveResizedPhoto($img1, $width, $height, $source_folder, $destination_folder);
      }

      updateTable($table_name, " catIcon='$img1' where catID='$catID'");
    }
  }


  if ($_FILES['header_icon_image']['name'] != "") {
    $file_extension = strtolower(getExtension($_FILES['header_icon_image']['name']));
    if ($file_extension != "jpg" && $file_extension != "gif" && $file_extension != "jpeg" && $file_extension != "png" && $file_extension != "webp") {
      $_SESSION['session_message'] = '<div class="btn btn-warning"> Please upload image (.jpg,.gif,.png,.webp Format Only) </div>';
      header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
      exit;
    }
    if ($_FILES['header_icon_image']['name'] != "") {
      $categoryRes = getResult($table_name, " where catID='$catID'", "header_icon_image");
      $filename = $categoryRes['header_icon_image'];
      if ($filename != "") {
        $file = site_url . "/uploaded-files/category/caticon/" . $filename;
        if (file_exists($file)) {
          unlink($file);
        }
      }
      $cat = str_replace(" ", "-", $catname);
      $img_name = $cat . uniqid();
      $img1 = upload_file($img_name, "header_icon_image", "uploaded-files/category/caticon");

      $width = "50";
      $height = "50";
      $source_folder = SITE_DIR_PATH . "/uploaded-files/category/caticon";
      $destination_folder = SITE_DIR_PATH . "/uploaded-files/category/caticon/thumbs/";
      saveResizedPhoto($img1, $width, $height, $source_folder, $destination_folder);

      updateTable($table_name, " header_icon_image='$img1' where catID='$catID'");
    }
  }


  if ($_FILES['cat_home_image']['name'] != "") {
    $file_extension = strtolower(getExtension($_FILES['cat_home_image']['name']));
    if ($file_extension != "jpg" && $file_extension != "gif" && $file_extension != "jpeg" && $file_extension != "png" && $file_extension != "webp") {
      $_SESSION['session_message'] = '<div class="btn btn-warning"> Please upload image (.jpg,.gif,.png,.webp Format Only) </div>';
      header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
      exit;
    }
    if ($_FILES['cat_home_image']['name'] != "") {
      $categoryRes = getResult($table_name, " where catID='$catID'", "cat_home_image");
      $filename = $categoryRes['cat_home_image'];
      if ($filename != "") {
        $file = site_url . "/uploaded-files/category/images/" . $filename;
        if (file_exists($file)) {
          unlink($file);
        }
      }
      $cat = str_replace(" ", "-", $catname);
      $img_name = $cat . uniqid();
      $img1 = upload_file($img_name, "cat_home_image", "uploaded-files/category/images");

      $width = "242";
      $height = "242";

      $source_folder = SITE_DIR_PATH . "/uploaded-files/category/images";
      $destination_folder = SITE_DIR_PATH . "/uploaded-files/category/images/thumbs/";
      saveResizedPhoto($img1, $width, $height, $source_folder, $destination_folder);

      updateTable($table_name, " cat_home_image='$img1' where catID='$catID'");
    }
  }


  if ($_FILES['catHeadingImage']['name'] != "") {
    $file_extension = strtolower(getExtension($_FILES['catHeadingImage']['name']));
    if ($file_extension != "jpg" && $file_extension != "gif" && $file_extension != "jpeg" && $file_extension != "png" && $file_extension != "webp") {
      $_SESSION['session_message'] = '<div class="btn btn-warning"> Please upload image (.jpg,.gif,.png,.webp Format Only) </div>';
      header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
      exit;
    }
    if ($_FILES['catHeadingImage']['name'] != "") {
      $categoryRes = getResult($table_name, " where catID='$catID'", "catHeadingImage");
      $filename = $categoryRes['catHeadingImage'];
      if ($filename != "") {
        $file = site_url . "/uploaded-files/category/images/" . $filename;
        if (file_exists($file)) {
          unlink($file);
        }
      }
      $cat = str_replace(" ", "-", $catname);
      $img_name = $cat . uniqid();
      $img3 = upload_file($img_name, "catHeadingImage", "uploaded-files/category/images");

      $width = "636";
      $height = "380";

      $source_folder = SITE_DIR_PATH . "/uploaded-files/category/images";
      $destination_folder = SITE_DIR_PATH . "/uploaded-files/category/images/thumbs/";
      saveResizedPhoto($img3, $width, $height, $source_folder, $destination_folder);

      updateTable($table_name, " catHeadingImage='$img3' where catID='$catID'");
    }
  }


  $q = updateTable($table_name, " pageDescription='" . $metadesc . "', catName='" . $catname . "',catUrl='" . $catUrl . "',catOldUrl='" . $catOldUrlUp . "', displayName='" . $catDname . "', catDesc='" . $shortdesc . "',catDesc1='" . $fulldesc . "', heading1='" . $heading1 . "',heading2='" . $heading2 . "',heading3='" . $heading3 . "',pageTitle='" . $metatitle . "', pageKeywords='" . $metakeyword . "',alt='" . $alt . "',title='" . $title . "',is_redirect='" . $is_redirect . "',redirect_link='" . $redirect_link . "',catHeading1='$catHeading1',keyword1='" . $keyword1 . "',keyword2='" . $keyword2 . "',keyword3='" . $keyword3 . "',catHeading2='$catHeading2',catHeading3='$catHeading3',catHeadingButton='$catHeadingButton',catHeadingLink='$catHeadingLink',catHeadingImageAlt='$catHeadingImageAlt',catHeadingImageTitle='$catHeadingImageTitle' where catID='$catID'");

  $multiCatimage=$_FILES['m_image'];
  // echo "<pre>";print_r($multiCatimage);die; 
  $targetDir = "uploaded-files/category/images";
    if ($multiCatimage != " ") {
      
      foreach ($multiCatimage['name'] as $key => $image_name) {
        $_FILES['multi']['name'] = $image_name;
        $_FILES['multi']['type'] = $multiCatimage['type'][$key];
        $_FILES['multi']['tmp_name'] = $multiCatimage['tmp_name'][$key];
        $_FILES['multi']['error'] = $multiCatimage['error'][$key];
        $_FILES['multi']['size'] = $multiCatimage['size'][$key];
        $cat1 = str_replace(" ", "-", $catname);
        $img_name1 = $cat1 . time() . '_' . $key;
        $path = upload_file($img_name1, "multi", "uploaded-files/category/images");
        //  print_r($path); die;
        // $width = "636";
        // $height = "380";

        // $source_folder = SITE_DIR_PATH . "/uploaded-files/category/images";
        // $destination_folder = SITE_DIR_PATH . "/uploaded-files/category/images/thumbs/";
        // saveResizedPhoto($path, $width, $height, $source_folder, $destination_folder);
        if($path != ''){
            $data2['path'][] = $path;
            // echo "INSERT INTO `categoryImage` SET cat_id='$catID', categ_image='$val'";die;
        }
      }
      // echo "<pre>";print_r($data2);die; 
      
      foreach($data2['path'] as $val){
        // $sql = mysqli_query($GLOBALS['dbconn'], "INSERT INTO `categoryImage` SET cat_id='$catID', categ_image='$val'");
       
        $stmt = $GLOBALS['dbconn']->prepare("INSERT INTO categoryImage (cat_id, categ_image) VALUES (?, ?)");
        $stmt->bind_param("is", $catID, $val);
        $stmt->execute();

        // $sql = mysqli_query($GLOBALS['dbconn'], "insert into `categoryImage` set cat_id='$catID','categ_image'='$val'");
      }
    }


  $_SESSION['session_message'] = '<div class="btn btn-success">' . $record_type . ' has been updated successfully  </div>';

  //echo mysqli_error($db);

  //header("Location: " . SITE_ADMIN_URL . "/" . $redirect_script_name);

  header("Location: " . SITE_ADMIN_URL . "/" . $redirect_script_name . "?start=" . $start . "&parentID=" . $parentID . "&catID=" . $catID . "&pagesize=" . $pagesize);
  exit;
}
########################################################
admin_header();
$res = getResult($table_name, " where catID='$catID'");

$qryTool = db_query("select * from category_tooltip_tbl where cat_id='$catID'");


?>
<div class="content-wrapper">
    <div class="page-header">
        <h3 class="page-title">
            <?= $heading; ?>
        </h3>
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="nav-item d-none d-lg-flex">
                    <a class="nav-link" href="<?= admin_url ?>manage-category.php?parentID=<?= $parentID; ?>">
                        <span class="btn btn-primary">Go Back</span>
                    </a>
                </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" id="formSample" method="post" action="" enctype="multipart/form-data"
                        onsubmit="return validate(this);">
                        <div class="form-group row">
                            <div class="col">
                                <label>Category Name *</label>
                                <div id="the-basics">
                                    <input class="typeahead" type="text" id="catName" name="catname"
                                        placeholder="Category Name" value="<?= $res['catName'] ?>" required>
                                </div>
                            </div>




                            <div class="col">
                                <label>Category Display Name</label>
                                <div id="bloodhound">
                                    <input class="typeahead" type="text" name="catDname"
                                        value="<?= $res['displayName'] ?>" placeholder="Category Display Name" required>
                                </div>
                            </div>
                        </div>
                        <!-- <div class="form-group row">
              <div class="col">
                <label>Heading 1</label>
                <div id="the-basics">
                  <input class="typeahead" type="text" name="heading1" value="<?= $res['heading1'] ?>"
                    placeholder="Heading 1">
                </div>
              </div>
              <div class="col">
                <label>Heading 2</label>
                <div id="bloodhound">
                  <input class="typeahead" type="text" name="heading2" value="<?= $res['heading2'] ?>"
                    placeholder="Heading 2">
                </div>
              </div>
            </div> -->
                        <div class="form-group">
                            <label for="exampleTextarea1">Category URL*</label>
                            <input class="typeahead" type="text" id="catUrl" name="catUrl" readonly
                                value="<?= $res['catUrl']; ?>" placeholder="Category URL">

                            <input class="typeahead" type="hidden" id="catOldUrl" name="catOldUrl" readonly
                                value="<?= $res['catUrl']; ?>" placeholder="Category Old URL">

                            <input class="typeahead" type="hidden" id="catOldUrlCheck" name="catOldUrlCheck" readonly
                                value="<?= $res['catOldUrl']; ?>" placeholder="Category Old URL Pass">
                        </div>



                        <!-- <?php
            if ($res['catID'] == "") { ?>
                        <div class="form-group row">
                            <div class="col">
                                <label for="exampleTextarea1">Category Header Icon Image</label>
                                <input type="file" name="header_icon_image">
                            </div>


                        </div>
                        <?php } else { ?>
                        <div class="form-group row">
                            <div class="col">
                                <label>Category Header Icon Image</label>
                                <input type="file" name="header_icon_image">
                            </div>


<?php if($res['header_icon_image']!='')
{?>
                            <div class="col">
                                <img src="<?= site_url . "/uploaded-files/category/caticon/" . $res['header_icon_image'] ?>"
                                    alt="image" width="50" height="50">
                            </div>
                            <?php }?>
                        </div>
                        <?php   } ?> -->




<!-- 
                        <div class="form-group row">
                            <div class="col-md-6">
                                <label class="col-md-12 col-form-label le">Do you want redirect on existing Link
                                    ?</label>
                                <div class="row">
                                    <div class="col-sm-4">
                                        <div class="form-check">
                                            <label class="form-check-label">
                                                <input type="radio" class="form-check-input" name="is_redirect"
                                                    value="1" <?= ($res['is_redirect'] == 1) ? 'checked' : ''; ?>> Yes
                                            </label>
                                        </div>
                                    </div>
                                    <div class="col-sm-5">
                                        <div class="form-check">
                                            <label class="form-check-label">
                                                <input type="radio" class="form-check-input" name="is_redirect"
                                                    value="0" <?= ($res['is_redirect'] == 0) ? 'checked' : ''; ?>>
                                                No
                                            </label>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>

                        <div class="form-group" style="display:none" id="redirectL">

                            <input class="typeahead" type="text" name="redirect_link" placeholder="Enter Redirect Link"
                                value="<?= $res['redirect_link'] ?>">
                        </div>

                        <div class="form-group">
                            <label for="exampleTextarea1">Category Header Text</label>
                            <input class="typeahead" type="text" name="heading2" placeholder="Category Header Text"
                                value="<?= $res['heading2'] ?>" placeholder="Heading 3">
                        </div> -->

                        <!-- <div class="form-group row d-none">
              <div class="col">
                <label>User Type</label>
                <div id="bloodhound">
                  <select name="usertype" class="form-control">
                    <option value="Individual" <?= ($res['usertype'] == 'Individual') ? 'selected' : ''; ?>>Individual</option>
                    <option value="Organization" <?= ($res['usertype'] == 'Organization') ? 'selected' : ''; ?>>Organization
                    </option>
                  </select>
                </div>
              </div>
              <div class="col">
                <label>Price</label>
                <div id="the-basics">
                  <input class="typeahead" type="number" name="catprice" value="<?= $res['catprice'] ?>"
                    placeholder="Price">
                </div>
              </div>
            </div> -->


                      

                        <div class="form-group ">
                            <label for="exampleTextarea1">Meta Title</label>
                            <input class="typeahead" type="text" name="metatitle" value="<?= $res['pageTitle'] ?>"
                                placeholder="Meta Title">
                        </div>
                        <div class="form-group">
                            <label for="exampleTextarea1">Meta Keyword</label>
                            <input class="typeahead" type="text" name="metakeyword" value="<?= $res['pageKeywords'] ?>"
                                placeholder="Meta Keyword">
                        </div>
                        <div class="form-group">
                            <label for="exampleTextarea1">Meta Description</label>
                            <textarea class="form-control" name="metadesc"><?= $res['pageDescription'] ?></textarea>
                        </div>
                        <div class="row align-items-center">
         <div class="col-md-4">
                    <div class="form-group">
                        <label for="input2">Keyword 1</label>
                        <input type="text" name="keyword1" class="form-control" value= "<?=$res['keyword1'];?>">
                    </div>
                </div>
                
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="input2">Keyword 2</label>
                        <input type="text" name="keyword2" class="form-control" value="<?=$res['keyword2'];?>">
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="input2">Keyword 3</label>
                        <input type="text" name="keyword3" class="form-control" value="<?=$res['keyword3'];?>">
                    </div>
                </div>
                </div>

                        <div class="form-group">
                            <label for="exampleTextarea1">Category Short Description</label>
                            <textarea class="form-control editor" name="shortdesc"
                                rows="6"><?= $res['catDesc'] ?></textarea>
                        </div>

                        <!-- <div class="form-group">
                        <label for="exampleTextarea1">Heading 2</label>
                        <input type="text" name="heading2" class="form-control" value="<?=$res['heading2'];?>">
                        </div> -->
                        <div class="form-group">
                            <label for="exampleTextarea1">Category Header 2</label>
                            <input class="typeahead" type="text" name="heading2" placeholder="Category Header Text"
                                value="<?= $res['heading2'] ?>" placeholder="Heading 2">
                        </div>
                        
                        <div class="form-group">
                            <label for="exampleTextarea1">Category Description</label>
                            <textarea class="form-control editor" name="fulldesc"
                                rows="4"><?= $res['catDesc1'] ?></textarea>
                        </div>

                          

                                                       
  <div class="form-group">
    <label for="email">Category Multiple Images *:</label>

    <input type="file" name="m_image[]" class="form-control" multiple size="60"
      id="NOBLANK~Please enter Person Name.~DM~" />
  </div>
  <?php
  if ($res['multi_image'] != "") {
    $image_array = explode(',', $res['multi_image']); ?>
    <div class="display-img">
      <ul>
        <?php foreach ($image_array as $image) { ?>
          <li>

            <img src="<?= site_url; ?>/uploaded-files/category/images/<?= $image ?>">

            <!-- <div class="card-footer">
              <a href="<= SITE_ADMIN_URL ?>/addeditcategory.php?id=delete&name=<?= $image ?>&cat_id=<?= $catID ?>"
                onclick="confirm('Do you want to delete the image?')">Delete</a>
            </div> -->

          </li>
        <?php } ?>
      </ul>
    </div>
  <?php } ?>





                        <!-- <div class="form-group">
              <label for="exampleTextarea1">Uses of Certificate</label>
              <textarea class="form-control editor" name="certificateUsed"
                rows="4"><= $res['certificateUsed'] ?></textarea>
            </div> -->

                        <?php
            if ($res['catID'] == "") { ?>
                        <div class="form-group row">
                            <div class="col">
                                <label for="exampleTextarea1">Category Image</label>
                                <input type="file" class="dropify" name="image">
                            </div>


                            <div class="col">
                                <label>Alt </label>

                                <input class="typeahead" type="text" name="alt" placeholder="Image Alt"
                                    value="<?= $res['alt'] ?>">
                            </div>
                            <div class="col">
                                <label>Title </label>

                                <input class="typeahead" type="text" name="title" placeholder="Image Title"
                                    value="<?= $res['title'] ?>">
                            </div>



                        </div>
                        <?php } else { ?>
                        <div class="form-group row">
                            <div class="col">
                                <label>Category Image</label>
                                <input type="file" class="dropify" name="image">
                            </div>
                            <div class="col">
                                <label>Alt </label>

                                <input class="typeahead" type="text" name="alt" placeholder="Image Alt"
                                    value="<?= $res['alt'] ?>">
                            </div>
                            <div class="col">
                                <label>Title </label>

                                <input class="typeahead" type="text" name="title" placeholder="Image Title"
                                    value="<?= $res['title'] ?>">
                            </div>

<?php if($res['catImage']!='')
{?>
                            <div class="col">
                                <img src="<?= site_url . "/uploaded-files/category/images/" . $res['catImage'] ?>"
                                    alt="image" width="200" height="200">
                            </div>
                            <?php }?>


                        </div>
                        <?php   } ?>

                        <?php
            if ($res['catID'] == "") { ?>
                        <div class="form-group">
                            <label for="exampleTextarea1">Category Home Image (500 X 500 Px)</label>
                            <input type="file" class="dropify" name="cat_home_image">
                        </div>
                        <?php } else { ?>
                        <div class="form-group row">
                            <div class="col">
                                <label>Category Home Image</label>
                                <input type="file" class="dropify" name="cat_home_image">
                            </div>
                            <?php if($res['cat_home_image']!='')
                            {?>
                            <div class="col">
                                <img src="<?= site_url . "/uploaded-files/category/images/" . $res['cat_home_image'] ?>"
                                    alt="image" width="200" height="200">
                            </div>
                            <?php }?>
                        </div>
                        <?php   } ?>

                        <?php
            if ($parentID == 0) {
              if ($res['catID'] == "") { ?>
                        <div class="form-group">
                            <label for="exampleTextarea1">Category Icon</label>
                            <input type="file" class="dropify" name="catIcon">
                        </div>
                        <?php } else { ?>
                        <div class="form-group row">
                            <div class="col">
                                <label>Category Icon</label>
                                <input type="file" class="dropify" name="catIcon">
                            </div>
                        <?php if($res['catIcon']!='')
                        {?>
                            <div class="col">
                                <img src="<?= site_url . "/uploaded-files/category/caticon/" . $res['catIcon'] ?>"
                                    alt="image" width="200" height="200">
                            </div>
                            <?php }?>
                        </div>
                        <?php  }
            } ?>




                        <!-- <div class="form-group">
              <label for="exampleTextarea1">Category Icon</label>
              <input type="file" class="form-control editor" name="catIcon" value="">
            </div> -->
                        <!-- <div class="form-group d-none">
              <label for="exampleTextarea1">Required Documents <span class="text-danger">(Must be seperate by 'comma')</span></label>
              <input type="text" class="form-control editor" name="required_doc" value="<?= $res['required_doc'] ?>">
            </div> -->
                        <!-- <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">GST, Income Tax, EPF, Patent Trademark Registration</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="gst" value="1"
                          <?= ($res['gst'] == 1) ? 'checked' : ''; ?>> Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="gst" value="0"
                          <?= ($res['gst'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">MCA (ROC) Director’s KYC, Partner’s KYC</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="mca" value="1"
                          <?= ($res['mca'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="mca" value="0"
                          <?= ($res['mca'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le"> Start-up India</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="epf" value="1"
                          <?= ($res['epf'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="epf" value="0"
                          <?= ($res['epf'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">Import Export Code (IEC)</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="iec" value="1"
                          <?= ($res['iec'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="iec" value="0"
                          <?= ($res['iec'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">E-Ticketing</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="ptr" value="1"
                          <?= ($res['ptr'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="ptr" value="0"
                          <?= ($res['ptr'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">IceGate – AD Code Reg.</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="eticket" value="1"
                          <?= ($res['eticket'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="eticket" value="0"
                          <?= ($res['eticket'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">IceGate - Customs Portal</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="cp" value="1"
                          <?= ($res['cp'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="cp" value="0"
                          <?= ($res['cp'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">CBSE - School</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="cbe" value="1"
                          <?= ($res['cbe'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="cbe" value="0"
                          <?= ($res['cbe'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">Login into e-Tender Portal</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="etp" value="1"
                          <?= ($res['etp'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="etp" value="0"
                          <?= ($res['etp'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">Vendor / Bidder (eProcure.gov.in) | E-Auctioning</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="vb" value="1"
                          <?= ($res['vb'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="vb" value="0"
                          <?= ($res['vb'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">DGFT - Foreign Trade</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="dgft" value="1"
                          <?= ($res['dgft'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="dgft" value="0"
                          <?= ($res['dgft'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">Country of Origin-Code  </label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="iet" value="1"
                          <?= ($res['iet'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="iet" value="0"
                          <?= ($res['iet'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div> -->


                        <?php
            if ($res['catID'] == "") {
            ?>
                        <button type="submit" class="btn btn-primary mr-2" name="add_record">Submit</button>
                        <input type="hidden" name="action" value="add_record">
                        <?php
            } else {
            ?>
                        <button type="submit" class="btn btn-primary mr-2" name="update_record" id="idsUp">Update</button>
                        <input type="hidden" name="action" value="update_record">
                        <?php
            }
            ?>
                        <button class="btn btn-light"
                            onclick="javascript: window.location.href = '<?= SITE_ADMIN_URL; ?>/<?= $redirect_script_name; ?>?parentID=<?= $parentID; ?>&catID=<?= $catID; ?>&start=<?= $start; ?>&pagesize=<?= $pagesize; ?>'">Cancel</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- content-wrapper ends -->

<!-- Modal -->
 
<?php
admin_footer();
?>

<script>
$(document).ready(function() {
    var autocheck = $("input[type='radio'][name='is_redirect']:checked").val();
    if (autocheck == '1') {
        $('#redirectL').show();
    }

    $("input[type='radio'][name='is_redirect']").click(function() {

        var checkedVal = $(this).val();

        if (checkedVal == '1') {
            $('#redirectL').show();
        } else {
            $('#redirectL').hide();
        }

    })
})
</script>
<script>
$(document).ready(function() {
    $('#catName').on('input blur', function() {
        let input = $(this).val();
        let inputResponse = removeSpecialChars(input);

        $('#catUrl').val(inputResponse);


        // $.ajax({
        //     url: 'your-server-endpoint', // Replace with your server endpoint
        //     type: 'POST',
        //     data: { value: inputValue },
        //     success: function(response){
        //         $('#result').html(response);
        //     },
        //     error: function(xhr, status, error){
        //         console.error('AJAX Error: ' + status + error);
        //     }
        // });
    });
});
</script>

<script>
var sll = 1;
$('#addMore').click(function() {
    // alert(sll);

    $('#dynamicField').append('<div id="dataLoad'+sll +'"><div class="form-row"> <div class="form-group col-md-6"> <label for="Heading">Tooltip Heading '+sll +'</label> <input type="text" class="form-control" id="toolipHeading" name="toolipHeading[]"> </div> <div class="form-group col-md-6"> <label for="Image">Tooltip Image '+sll +' </label> <input type="file" class="form-control" id="toolipImage" name="toolipImage[]"> </div> </div> <div class="form-row"> <div class="form-group col-md-10"> <label for="Heading">Tooltip Content '+sll +'</label> <textarea class="form-control" name="toolTipContent[]" rows="2"></textarea> </div> <div class="form-group col-md-2"> <button type="button" name="remove" id="' + sll + '" class="btn btn-danger btn_remove">X</button> </div> </div></div>'
    );
    sll++;
});

$(document).on('click', '.btn_remove', function() {
    var button_id = $(this).attr("id");
    $('#dataLoad' + button_id + '').remove();
});

$('#addMoreUpdate').click(function() {
    // alert(sll);

    $('#dynamicField').append('<div id="dataLoad'+sll +'"><div class="form-row"> <div class="form-group col-md-6"> <label for="Heading">Tooltip Heading '+sll +'</label> <input type="text" class="form-control" id="toolipHeading" name="toolipHeadingUp[]"> </div> <div class="form-group col-md-6"> <label for="Image">Tooltip Image '+sll +' </label> <input type="file" class="form-control" id="toolipImage" name="toolipImageUp[]"> </div> </div> <div class="form-row"> <div class="form-group col-md-10"> <label for="Heading">Tooltip Content '+sll +'</label> <textarea class="form-control" name="toolTipContentUp[]" rows="2"></textarea> </div> <div class="form-group col-md-2"> <button type="button" name="remove" id="' + sll + '" class="btn btn-danger btn_remove">X</button> </div> </div></div>'
    );
    sll++;
});

$(document).on('click', '.btn_remove', function() {
    var button_id = $(this).attr("id");
    $('#dataLoad' + button_id + '').remove();
});
</script>
<!-- <script>
$(document).ready(function () {
    $("#formSample").on('submit', function (e) {
        e.preventDefault();
        
        var formData = new FormData(this);
        
        formData.append('catID', '<?=$catID;?>')

        $.ajax({
            url: "addToolTip.php",
            type: "POST",
            data: formData,
            contentType: false,
            cache: false,
            processData: false,
            success: function (response) {
                $("#message").html(response);
            },
            error: function () {
                $("#message").html("<p>An error has occurred</p>");
            }
        });
    });
});

</script> -->

← Back to Directory Edit File 🔒 Chmod

WP File Manager