So, I created a bunch of drop down options like this:
And I have a table in my database called 'recipes' which will contain meal names and the number of the various ingredients required to make them.
When a user chooses inputs using the drop down boxes and submits it via the POST function, I want to be able to sum the total ingredients required for all the meals they have chosen and echo those values. How can I do this?
My code for the drop down boxes is here:
<label for="dinner7">S</label>
<select name="dinner7" id="mealSelect">
<option name=default id=defaultSelect>None</option>
<?php
$sqli = "SELECT * FROM recipes;";
$result = mysqli_query($connect, $sqli);
while ($row = mysqli_fetch_assoc($result)) {
$mealname = $row['mealname'];
echo "<option>$mealname</option>\n";
}
?>
</select>

