<?php if (isset($_POST['button_save_product'])) { if (isset($_POST['addProduct_marka'], $_POST['nomer'], $_POST['names'], $_POST['kol'], $_POST['price'])) { require '../model/class_connect_db.php'; require '../model/class_insert.php'; $insert = new Insert(); $result1 = $insert->add_product($_POST['addProduct_marka'], $_POST['nomer'], $_POST['names'], $_POST['kol'], $_POST['price']); $result2 = $insert->add_img(); if ($result1 == true) { if ($result2 == true) { header("Location: ../pages/add_product.php"); } else { echo '$result2'; return; } } else { echo '$result1'; return; } } } else { echo 'ERORR: not detected click on button'; }
$roominess = $_POST['roominess_mav']; } else { $roominess = $_POST['roominess_mob']; } if (isset($_POST['short_description'])) { $short_description = trim($_POST['short_description']); } else { $short_description = NULL; } isset($_POST['name']) ? $name = $_POST['name'] : ($name = ''); isset($_POST['price']) ? $cost = $_POST['price'] : ($cost = ''); isset($_POST['weight']) ? $weight = $_POST['weight'] : ($weight = ''); $number_inputs = $_POST['number_inputs']; $specifications = isset($_POST['text2']) ? $_POST['text2'] : NULL; $extra_options = isset($_POST['text1']) ? $_POST['text1'] : NULL; $title = $_POST['title']; $description = isset($_POST['description']) ? $_POST['description'] : NULL; $keywords = $_POST['keywords']; if (!empty($_POST['id_prod'])) { $id_prod = $_POST['id_prod']; $obj_product = new Update(); $result = $obj_product->update_product($id_prod, $id_company, $type, $id_water_resistance, $number, $id_category, $id_frame, $name, $cost, $weight, $roominess, $number_inputs, $specifications, $short_description, $serialize_arr_img, $arr_attr, $title, $description, $keywords, $url_video, $color_tent, $extra_options, $related); } else { $obj_product = new Insert(); $result = $obj_product->add_product($id_company, $type, $id_water_resistance, $number, $id_category, $id_frame, $name, $cost, $weight, $roominess, $number_inputs, $specifications, $short_description, $serialize_arr_img, $arr_attr, $title, $description, $keywords, $url_video, $color_tent, $extra_options, $related); } if ($result == true) { header('Location:../pages/products.php?id=' . $id_company); } else { echo $result; }