<?php
include("includes/header.php");
// code
error_reporting(E_ALL); //set error reporting to all
echo('<h1>Flour Calculator</h1>');
// initialize variables
$batches = isset($_POST['batches']) ? $_POST['batches'] : 0;
// filter input from browser
$batches = htmlentities($batches);
?>
<form action="flourcalculator.php" method="post">
<label for="dropdown">What are you baking?</label>
<select name="dropdown" id="dropdown" size="1">
<option value="muffins">Muffins</option>
<option value="cookies">Cookies</option>
<option value="bread">Bread</option>
<option value="pies">Pie</option>
<option value="cakes">Cake</option>
</select>
<br>
<label for="batchnumber">How many batches?</label>
<input type="number" name="batches" id="batches" value="" />
<br>
<label for="submit">Submit</label>
<input type="submit" name="submit" id="submit" value="Submit" />
<br>
<br>
<?php
$batchnum = abs($batches); // take the absolute value of the batches variable
$muffin = 0.667;
$cookies = 3;
$bread = 4.5;
$pie = 2.5;
$cake = 2;
echo("You need $batchnum cups of flour!");
?>
<?php
include("includes/footer.php");
?>