Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

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

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions