Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an HTML document to create a form with the following capabilities: a. A te

ID: 3804524 • Letter: W

Question

Write an HTML document to create a form with the following capabilities:

a. A text box to collect the user’s name

b. Four checkboxes, one each for the following items:

i. Four 25-watt light bulbs for $2.39

ii. Eight 25-watt light bulbs for $4.29

iii. Four 25-watt long-life light bulbs for $3.95

iv. Eight 25-watt long-life light bulbs for $7.49

c. A collection of three radio buttons that are labeled as follows:

i. Visa

ii. Master Card

iii. Discover

- Write a PHP script that computes the sub total cost of the ordered light bulbs. Add 6.2 percent sales tax. Display the total price.

- The program should save the order to the text file. (save: name, selections, subtotal, tax, total)

- The program must inform the buyer of exactly what was ordered. (show your order on the HTML/PHP file)

Explanation / Answer

form_9.10_copy.php

<html>

<head>
    <title>Computing Lightbulb Cost</title>
    <link rel="stylesheet" type="text/css" href="hw2.css" />
</head>

<body>
    <p>
  
    <?php
        $userName = $_POST["user_name"];
        $fourRegular = $_POST["option1"];
        $eightRegular = $_POST["option2"];
        $fourLong = $_POST["option3"];
        $eightLong = $_POST["option4"];
        $payment = $_POST["paymentMethod"];
        $total = 0;
        $tax = 1.062;
          
    if ((isset($userName) && (!empty($userName))))
        {
            if (preg_match("/^[A-zs]+$/", $userName))
            {
                if(!empty($lightbulbType_list))
                {
                    if(!empty($payment))
                    {
                        echo "Thank you for your submission $userName<br />";
                        echo "Your payment method: $payment<br />";
                        foreach ($lightbulbType_list as $lightBulb){
                            $total += ($lightBulb * $tax);
                            echo "Prices of selected lightbulbs: $$lightBulb <br />";
                        }
                        echo "total price is $".round($total, 2)."<br />";
                    }
                } else {
                    echo "Please make your lightbulb selection <br />";
    ?>
    Please <a href="form_9.9.html">go back</a> and enter the required fields
    <?php
                }
            } else {
                echo "Only alphabetical characters allowed <br />";
    ?>
    Please <a href="form_9.9.html">go back</a> and enter the required fields
    <?php
            }
        } else {
            echo "Please check your inputs and selections <br />";
    ?>
    Please <a href="form_9.9.html">go back</a> and enter the required fields
    <?php
        }
    ?>
    </p>
</body>

</html>


<!-- 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. -->


form_9.9.html

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>Light Bulb Purchase Form</title>
    <link rel="stylesheet" type="text/css" href="hw2.css" />
</head>

<body>
    <h1>Welcome to the lightbulb page <img id="lightbulbPic" src="hw2 files/lightbulb.png" alt="picture of lightbulb" />
    </h1>


    <form method="post" name="lightbulb" action="form_9.10.php">

        <fieldset>
            <legend>Enter Your Name: </legend>
            <label>Name:
                <input type="text" name="user_name" />
            </label>
        </fieldset>
        <fieldset>
            <legend>Select Lightbulbs(You may select more than 1): </legend>
            <label><input type="checkbox" name="option1" value="fourRegularBulb" />
            4 x 25-watt light bulb for $2.39 <br/>
            </label>
            <label><input type="checkbox" name="option2" value="eightRegularBulb" />
            8 x 25-watt light bulb for $4.29 <br/>
            </label>
            <label><input type="checkbox" name="option3" value="fourLongLifeBulb" />
            4 x 25-watt long-life bulb for $3.95 <br/>
            </label>
            <label><input type="checkbox" name="option4" value="eightLongLifeBulb" />
            8 x 25-watt long-life bulb for $7.49
            </label>
        </fieldset>
        <fieldset>
            <legend>Method of Payment</legend>
            <label><input type="radio" name="paymentMethod" value="visa" checked="checked"/>
            Visa
            </label>
            <label><input type="radio" name="paymentMethod" value="mastercard" />
            MasterCard
            </label>
            <label><input type="radio" name="paymentMethod" value="discover" />
            Discover
            </label>
        </fieldset>
        <p>
            <input id="submitButton" type="submit" value="Submit" />
        </p>
    </form>
    <p>
        <a href="http://validator.w3.org/check?uri=https://swe.umbc.edu/~kyongk1/is448/1119-kyongk1-hw2/form_9.9.html">
            <img src="hw2 files/valid-xhtml11.png" alt="Valid HTML5" /></a>
        <a href="http://jigsaw.w3.org/css-validator/validator?uri=https://swe.umbc.edu/~kyongk1/is448/1119-kyongk1-hw2/form_9.9.html">
            <img src="hw2 files/vcss.gif" alt="Valid CSS" /></a>
    </p>
</body>

</html>

<!--
a. A text widget to collect the user’s name

b. Four checkboxes, one each for the following items:
i. Four 25-watt light bulbs for $2.39
ii. Eight 25-watt light bulbs for $4.29
iii. Four 25-watt long-life light bulbs for $3.95
iv. Eight 25-watt long-life light bulbs for $7.49

c. A collection of three radio buttons that are labeled as follows:
i. Visa ii. Master Card iii. Discover
-->


hw2.css

body {
    background-color: #607D8B;
    color: black;
    font-family: Georgia, Garamond, serif;
    margin: 10px auto 10px auto;
    border: 10px #D8C858 solid;
}
h1 {
    text-align: center;
}
fieldset {
    padding: 10px;
    margin: 10px;
    border: 2px solid black;
}
legend, caption {
    font-weight: bold;
}
table {
    background-color: #9E9E9E;
    margin: 10px auto 10px auto;
}
th, td {
    text-align: left;
    text-transform: uppercase;
    border: 1px solid black;
}
th {
    font-weight: bold;
}
#lightbulbPic {
    height: 80px;
    width: 15%;
}
#submitButton {
    margin-left: 10px;
}
.endNote {
    text-align: center;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote