public function addSupplier() { $name = $_POST['sup-name']; $email = $_POST['sup-email']; $contact = $_POST['sup-contact']; $fuel = $_POST['fuel-sup']; $lubricant = $_POST['lubricant-sup']; require 'models/Stocks_model.php'; $model = new Stocks_model(); if ($fuel == "on") { $fuel = "fuel"; // if($model->addSupplier($name,$fuel,$email,$contact)){ // // return true; // } // else{ // // return false; // } $model->addSupplier($name, $fuel, $email, $contact); } else { if ($lubricant == "on") { $lubricant = "lubricant"; $model->addSupplier($name, $lubricant, $email, $contact); // if($model->addSupplier($name,$lubricant,$email,$contact)){ // return true; // } // else{ // return false; // } } else { $fuel = "fuel"; $lubricant = "lubricant"; $model->addSupplier($name, $fuel, $email, $contact); $model->addSupplier($name, $lubricant, $email, $contact); } } }