if (isset($_GET['function'])) { if ($ROUTE[$_GET['function']]['method2'] === 'GET') { if ($ROUTE[$_GET['function']]['url2'] === 'searchProduct' and (isset($_GET["product_name"]) or isset($_GET["product_category"]))) { $cont = new controllers(); //print $_GET["product_category"].$_GET["product_name"]; if (isset($_GET["product_name"])) { $product_name = $_GET["product_name"]; } else { $product_name = "null"; } if (isset($_GET["product_category"])) { $product_category = $_GET["product_category"]; } else { $product_category = "null"; } $cont->searchProductByGET($product_name, $product_category); } else { if ($_GET['function'] == "searchProduct") { $ret['message'] = "Undefined Product name or category"; $ret['status_code'] = 404; print json_encode($ret); } else { if ($_GET['function'] == "viewAll") { $cont = new controllers(); $cont->viewAllByGET(); } else { $ret['message'] = "Undefined function"; $ret['status_code'] = 404; print json_encode($ret); } }