<?php require '../model/class_connect_db.php'; //require('../model/class_set_categories.php'); require '../model/class_set_subcategory.php'; //if (isset($_POST['button_save_product'])) { if (isset($_POST['subcat']) && !empty($_POST['subcat'])) { $set_cat = new SetSubcategory(); $result_cat = $set_cat->set_names($_POST['table'], $_POST['subcat'], $_POST['company']); echo json_encode($result_cat); return; } else { $name_ru = $_POST['names']; $name_url = $_POST['url']; $title = $_POST['title']; $description = $_POST['description']; $keywords = $_POST['keywords']; $parent_id = $_POST['marka']; $set_cat = new SetCat(); $result_set_subcat = $set_cat->set_subcat($parent_id, $name_ru, $name_url); if ($result_set_subcat == true) { $result_set_names = $set_cat->set_names($title, $description, $keywords); if ($result_set_names == true) { header("Location: ../pages/catalog.php"); } else { echo 'ERROR: $result_set_names'; } } else { echo 'ERROR: $result_set_subcat'; } }
<?php require '../model/class_connect_db.php'; require '../model/class_set_categories.php'; //if (isset($_POST['button_save_product'])) { $name_ru = $_POST['names']; $name_url = $_POST['url']; $title = $_POST['title']; $description = $_POST['description']; $keywords = $_POST['keywords']; $set_cat = new SetCat(); $result_set_main_cat = $set_cat->set_main_cat($name_ru, $name_url); if ($result_set_main_cat == true) { $result_set_names = $set_cat->set_names($title, $description, $keywords); if ($result_set_names == true) { header("Location: ../pages/catalog.php"); } else { echo 'ERROR: $result_set_names'; } } else { echo 'ERROR: $result_set_main_cat'; } //}else{ echo "ERROR: NOT click on BUTTON";}