- By mond
- In junk removal
Test calculator ai
if ($_SERVER[“REQUEST_METHOD”] === “POST”) {
$items = $_POST[“items”] ?? []; // Get selected items
// Define the prices for each item
$itemPrices = [
“couch” => 120,
“mattress” => 110,
“dining_table” => 150,
“shelving_unit” => 100,
“bbq” => 100
];
$totalCost = 0;
// Calculate the total cost
foreach ($items as $item) {
if (isset($itemPrices[$item])) {
$totalCost += $itemPrices[$item];
}
}
// Display the total cost
echo ”
Total Cost: $”.$totalCost.”
“;
}