Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!

Rick Hammertime Desks

Welcome to Rick's Desks

Desk length in inches:

Desk width in inches:

Type of wood:

Number of drawers:


Purchase Order Details

Base charge: $200.00

Wood Type: $

Drawers: $

Subtotal:

Total:


$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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions