Create a two-part form that calculates blueberry farmer\'s weekly income from se
ID: 3784516 • Letter: C
Question
Create a two-part form that calculates blueberry farmer's weekly income from selling blueberries at the local Wichita Farmer's Market, based on the weight of berries sold and their cost, that can range from $3 to $8 a pound depending on the size of the berries. Use an HTML document named berries.html as a Web form with two text boxes - one for the pounds of blueberries sold and one for the price per pound. For the price you will have a drop down menu, but for the weight you will let the user type in a number. It should accept only numbers. Use a PHP document named berries.php as the form handler. If farmer sells 50lb of berries or more, the price will be time-and-a-half of what it is normally is, to make up for the special recyclable packaging.
Explanation / Answer
berries.html
<!DOCTYPE html>
<html>
<body>
<form action="berries.php">
First name:<br>
<input type="number" name="weight" value="Weight">
Pounds
<br>
<select name="price">
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
Dollar
<br><br>
<input type="submit" value="Submit">
<br><br>
</form>
</body>
</html>
berries.php
<?php
$w=$_GET["weight"];
$p=$_GET["price"];
$total=$w*$p;
if($w>=50)
{
echo "Total Price".($total/2);
}
else
{
echo "Total Price=".$total;
}
?>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.