<?php $title = "Add new Product"; include("head.php"); $con = connectBD(); $item_name = isset($_POST['item_name'])?$_POST['item_name']:""; $item_desc = isset($_POST['item_desc'])?$_POST['item_desc']:""; $price = isset($_POST['price'])?$_POST['price']:"0"; $category_id = isset($_POST['category_id'])?$_POST['category_id']:"0"; $item_price = isset($_POST['item_price'])?$_POST['item_price']:"0"; $item_qty = isset($_POST['item_qty'])?$_POST['item_qty']:"0"; if(isset($_GET['action']) && $_GET['action']=="edit") { $id = $_GET['id']; if(isset($_POST['item_name']) && $_POST['item_name']!="" && $_POST['item_desc']!="" && isset($_FILES['item_img']) && $_FILES['item_img']['size']>0) { $imgURL = "../images/" .$_FILES['item_img']['name']; move_uploaded_file($_FILES['item_img']['tmp_name'], $imgURL); if(editItem($con, $id , $item_name , $item_desc, $imgURL , $item_price, $category_id, $item_qty )) echo "<div class='info'>Product updatd successfully.</div>"; else echo "<div class='info'>Couldn't update this product, please try again later.</div>"; }else{