Question: Q1. rewrite the exercise on April 4 by adding the following operations: 1) In the php script, create an associative array named $order that stores

Q1. rewrite the exercise on April 4 by adding the following operations:

1) In the php script, create an associative array named $order that stores the following values:

- the number of cheese toppings;

- the number of pepperoni toppings;

- the number of ham toppings;

- the size of the ordered pizza;

- the number of the ordered pizza;

- the total cost of the order;

- the discount rate;

- the total cost after the discount.

2) the script assigns the values collected from the following fields:

- the number of each topping;

- the size of the ordered pizza;

- the number of the ordered pizza;

as the values of the elements of this array.

3) after calculating the total cost for an order, add the following values as the values of the elements of this array:

- the total cost of the order;

- the discount rate;

- the total cost after the discount;

as the values of the elements of this array.

4) applying foreach loop to print each element (key and value) of the associative array as a table. The text alignment, font size, and text color will be specified by a embedded css script that is generated by the php script.

Q1. rewrite the exercise on April 4 by adding the following operations:

exercise on April 4 code

// 1.html

Pizza

Pizza Order Form

Provide what you like and then you will know your total cost for your order.

// 1.php

if(isset($_POST['calculate']))

{

$cheese = $_POST['cheese'];

$pepperoni = $_POST['pepperoni'];

$ham = $_POST['ham'];

$size = $_POST['size'];

if($size=="small")

$size = 10;

elseif ($size=="medium")

$size = 12;

elseif ($size=="large")

$size = 14;

$pizzas = $_POST['pizzas'];

$total = $pizzas*($size+$cheese*2+$pepperoni*2+$ham*2);

$discount = 0;

if ($total>30 AND $total

$discount = 5;

elseif ($total>50 AND $total

$discount = 10;

elseif ($total>75 AND $total

$discount = 15;

elseif ($total>100)

$discount = 20;

else

$discount = 0;

$payment = ($total - ($total * ($discount / 100)));

}

?>

Order

We have received your order, thank you!

The detail of your order is below:

  • the number of cheese toppings=
  • the number of pepperoni toppings=
  • the number of ham toppings=
  • the size of the ordered pizza=
  • the number of the ordered pizza=

Your total cost is:

Order Information
toppings

cheese pepperoni ham size number cost discount payment

// style.css

body { background-color: pink; } label,p,h2 { color: blue; } #total { margin-left: 80px; } h1 { color: red; } .large { color: black; font-size: 105%; }

// webpage screenshots

127.0.0. 1/csc355/march%2028/1.html Pizza Order Form 127.0.0.1 says: the number of the toppings must be 0 127.00.1/csc355/april%209/example/pizza/1.php Order Information cheese pepperoni 2 ham size number total after reduction discount 12 $78 S66.3 15%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!