Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a two-part form that calculates fruit farmer\'s weekly income from sellin

ID: 3783599 • Letter: C

Question

Create a two-part form that calculates fruit farmer's weekly income from selling apples at the local Farmer's Market, based on the weight of apples sold and their cost, that can range from $3 to $8 a pound depending on the size of the apple. Use an HTML document named apples.html as a Web form with two text boxes, one for the pounds of apples 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 apples.php as the form handler. If farmer sells 50lb of apples or more, the price will be time-and-a-half of what it is normally is, to make up for the extra labor.

Explanation / Answer

Put these two file in same folder

apples.html

-----------------------------------------------------------------------------------------------------

<!DOCTYPE html>
<html>
<body>

<form action="apples.php">
First name:<br>
<input type="text" name="weight" value="Weight">
Pounds

<br>
<select name="price">
    <option value="30">30</option>
    <option value="40">40</option>
    <option value="50">50</option>
    <option value="60">60</option>
</select>
Dollar

<br><br>
<input type="submit" value="Submit">
<br><br>

</form>


</body>
</html>

------------------------------------------------------------------------------------------------------------

apples.php

<?php

$w=$_GET["weight"];
$p=$_GET["price"];


$total=$w*$p;


if($w>=50)
{
echo "Total Price".($total/2);
}
else
{
echo "Total Price=".$total;
}


?>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote