Question
This question is regarding PHP: A carpenter who wants a web page to compute the price of any desk a customer orders, based on the
This question is regarding PHP:
A carpenter who wants a web page to compute the price of any desk a customer orders, based on the following: desk length and width in inches, type of wood, and number of drawers. The price is computed as follows:
The base charge for all desks is $200.
If the surface area (length * width) is over 750 square inches, add $50.
If the wood is mahogany add $150, for oak add $125, and no extra for pine.
For every drawer in the desk, there is an additional $30 charge.
Here is my code, I'm struggling to put all the calculations together. Any help is greatly appreciated!
Welcome to Rick's Desks
$basePrice = '200';
$length = $_POST[length];
$width = $_POST[width];
$woodType = $_POST[woodType];
$drawers = $_POST[drawers];
$submit = $_POST[submit];
$drawerTotal = $_POST[drawerTotal];
$results = $_POST[results];
if ($woodType == 'mah'){
woodCO = '150';
}
if ($woodType == 'oak'){
woodCO = '125';
}
if ($woodType == 'pin'){
woodCO = '0';
}
else{
"Not a valid choice, please choose wood type."
}
if ($drawers < 0 ){
echo '
Invalid input
';} else {
$drawers * 30 = $drawerTotal;
echo $drawerTotal;
}
$baseline + $woodType = $results;
echo $results;
// check if the form was submitted -->
if (isset($_POST['submit'])){
$name = $_POST['woodType'];
$flavor = $_POST['length']
}
?>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started