require_once 'class.PotionShop.php'; $myShop = new PotionShop(); $error = 0; # Setup page information and execute code based on which button was pressed switch ($_POST["btn_action"]) { case "Add Potion": $btn_value = "Add Potion"; $action = "add"; break; case "Delete Potion": if (!$_POST["potion_id"]) { header("location: index.php"); exit; } $myShop->removePotion($_POST["potion_id"]); break; case "Edit Potion": if (!$_POST["potion_id"]) { header("location: index.php"); exit; } $btn_value = "Edit Potion"; $action = "edit"; $edit_potion = $myShop->singlePotion($_POST["potion_id"]); foreach ($edit_potion as $key => $value) { ${$key} = $value; } break; default: header("location: index.php");