$price1 = $_REQUEST['price']; $image_name1 = $_REQUEST['image_name']; $description1 = $_REQUEST['description']; if ($_FILES["image_path"]["error"] > 0) { echo "<font size = '5'><font color=\"#e31919\">Error: NO CHOSEN FILE <br />"; echo "<p><font size = '5'><font color=\"#e31919\">INSERT TO DATABASE FAILED"; } else { $uploaddir = "images/"; move_uploaded_file($_FILES["image_path"]["tmp_name"], "{$uploaddir}" . $_FILES["image_path"]["name"]); echo "<font size = '5'><font color=\"#0CF44A\">SAVED<br>"; } $file1 = "{$uploaddir}" . $_FILES["image_path"]["name"]; switch ($_REQUEST['operation']) { case "add": $product->addProduct("product_details", "product_name,price,image_name,image_path,description", "'{$product_name}','{$price}','{$image_name}','{$file}','{$description}'"); break; case "update": $product->updateProduct("product_details", "product_name='{$product_name1}',price='{$price1}',image_name='{$image_name1}',\r\n\timage_path='{$file1}',description='{$description1}'", "product_id='{$product_id1}'"); break; case "delete_rec": $product->deleteProduct("product_details", "product_id='{$product_id}'"); break; case "view": $product->viewProduct($product_list, $table); break; case "view_single": $product->viewSingleProduct($product_list, $table, $condition); break; default: echo "<H3 color='red'>Invalid Option Please Try again!</h3>"; }