} else { $status = 0; } //varriable which will contain the category in string format $category_string = ""; if (!empty($GLOBALS['_POST']['category']) && $GLOBALS['_POST'] > 0) { $category = $GLOBALS['_POST']['category']; //convert array to string seperated by commas foreach ($category as $cate) { $category_string = $category_string . "," . $cate; } /* - remove the first word from the $category_string sa it - it contains a comma */ $category_string = substr($category_string, 1); } //discount is set or not if (!empty($discount)) { //insert values in product table $result = $manageData->insertProduct($product_id, $category_string, $product_name, $description, $references, $old_price, $price_guest, $price_members, $tax, $discount, $stock, $date, $expiration_date, $maxpick, $status, $photo_name, $photo_name1, $photo_name2, $photo_name3, $photo_name4); if ($result == 1) { header("Location: ../../addProduct.php?msg=1111"); } else { if ($result == 0) { header("Location: ../../addProduct.php?msg=7777"); } } } else { header("Location: ../../addProduct.php?msg=9999"); }