Question: Write a PHP script that computes the total cost of the ordered light bulbs from Exercise 9.9 after adding 6.2 percent sales tax. The program

Write a PHP script that computes the total cost of the ordered light bulbs from Exercise 9.9 after adding 6.2 percent sales tax. The program must inform the buyer of exactly what was ordered, in a table.

So Far, I have this for the previous question I need to work off of...

Username:

Option Check Boxes

Four 25-watt light bulbs for $2.39 Eight 25-watt light bulbs for $4.29 Four 25-watt light bulbs for $3.95 Eight 25-watt light bulbs for $7.49

Option Radio Button

Visa Master Card Discover

if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = test_input($_POST["user"]); $checkbox = test_input($_POST["option1"]); $radio = test_input($_POST["option2"]); $array[]=array(2.39,4.29,3.29,7.49); if(empty($checkbox)) { echo("You didn't select any thing."); } else { $N = count($checkbox); for($i=0; $i < $N; $i++) { $count=$count+$array[$checkbox[$i]-1]; } } echo "Name".$name.",Cost:".$count.",Card:".$radio; }

function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?>

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!