<?php include_once "function/common_function.php"; $error_msg = ''; $error_set = ''; if (isset($_POST['business_id'])) { include_once 'function/category_class.php'; $obj_cat_type = new Category(); $post_visiable = 1; $user_id = $_SESSION['user_id']; $post_name = $_POST['name']; $post_category_type_id = $_POST['business_id']; $post_city = $_POST['city']; if (!empty($post_name) && !empty($post_category_type_id)) { // Check duplicate data $check_cat = $obj_cat_type->isCategoryExist($post_name, $post_category_type_id, $post_city, $user_id); if ($check_cat) { $check_portal_id = $obj_cat_type->add_portal_category($post_name, $post_category_type_id, $post_city, $post_visiable, $user_id); $arr_attr_id = $_POST['attr_id']; $arr_attr_val = $_POST['attr_arr']; if (!empty($arr_attr_id)) { $i = 0; $cat_id = $check_portal_id; foreach ($arr_attr_id as $key => $value) { if (!empty($arr_attr_val[$i])) { $attr_id = trim($arr_attr_id[$i]); $value = trim($arr_attr_val[$i]); $obj_cat_type->add_user_category_attribute($attr_id, $value, $user_id, $cat_id); } $i++; }