Assignment 4
You will be using the HTML form I’m linking to help you complete the following:
The price of a standard computer is $800 which includes the selected operating system,
Intel core i5, 8 GB memory, and 1TB hard drive.
Include the following options:
Processor: Intel Core i5 (no extra charge), Intel Core i7 (add $300), AMD Ryzen (add
$400)
Memory: 8GB (no extra charge), 16 GB (add $100), 32GB (add $200), 64GB (add
$400), 128GB (add $800)
Hard Disk: 1TB (no extra charge), 2TB ( add $44.99), 4TB (add $109.99), 8TB (add
$229.99), 10TB (add 279.99)
Battery backup: add $69
Webcam: add $79
Wireless mouse: add $49.99
Headset: add $69
Presentation clicker: add $42.99
Customers are allowed to customize the system by adding optional items. When the
customer selects "Finalize Sale" button, the form data should be sent to a PHP script.
Sample form (Next page):
Note: The cost of each optional component can be defined using the
"value" attribute of the co
esponding option of HTML elements in the
html document.
For example, you may use the following HTML structure for hard disk choices:
select name="hd"
option selected="selected" value="0">1TB
option
option value="44.99">2TB
option
option value="109.99">4TB
option
option value="229.99">8TB
option
option value="279.99">10TB
option
select
Note: selected="selected" attribute allows us to assign the default value.
If you select 1TB as the hard disk size, then the
owser will send the name/value pai
hd=0 to the server using POST method. Hence, $_POST["hd"] is 0.
If you select 2TB as the hard disk size, then the
owser will send the name/value pai
hd=44.99 to the server using POST method. Hence, $_POST["hd"] is 44.99.
Your PHP script should calculate and display the total amount (add 5% sales tax).
Requirements:
Customer must select an operating system. Otherwise, display an appropriate e
o
message and ask the customer to go back and select one.
Name cannot be empty. Include the 'required' attribute to each text element (input
type="text" ). If the name is empty, display an appropriate e
or message and ask the
customer to go back and select one.
Email cannot be empty. If the email is empty, display an appropriate e
or message and
ask the customer to go back and select one.
A sample output should be similar to the following:
Note: You should use HTML tags to format the output. For example, HTML table
structures is better for generating the output.
Important: you must define appropriate form method and action.
Note: Just like the text input boxes, use the co
esponding key (name) to access form
data sent to your PHP script. For example, if you define 'post' as the form method then
use the variable $_POST['os'] to read the operating system value sent to the server,
$_POST['memory'] to access the memory value.
Save the PHP script as assignment4.php
Submit the PHP code and HTML form as a zip file back to me.
Hint
As in the example, define appropriate associative a
ays to store data for each
component in your PHP script. For example, you may use an a
ay similar to the
following to store available operating systems:
$ops = a
ay("w10'=>'Windows 10', 'u12'=>'Ubuntu 17.4', ...);
( $ops['w10'] returns the value "Windows 10", ...)
Similarly, you may define associative a
ays to store cost of each component.
Read the selected operating system into a variable:
$selected_os = $_POST['os'];
Then you can use the $selected_os variable to access the a
ay and find the name of
selected operating system :
$ops[$selected_os] returns the value (name) of the selected operating system.
By default, all the values are read into variables as string values. Use typecasting to
ead option values as numeric values.
Assignment 2/stylSheet.css
.submitButton {
box-shadow:inset 0px -3px 7px 0px #29
ff;
background:linear-gradient(to bottom, #2dabf9 5%, #0688fa 100%);
background-color:#2dabf9;
border-radius:3px;
border:1px solid #0b0e07;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size:15px;
padding:9px 23px;
text-decoration:none;
text-shadow:0px 1px 0px #263666;
}
.submitButton:hover {
background:linear-gradient(to bottom, #0688fa 5%, #2dabf9 100%);
background-color:#0688fa;
}
.submitButton:active {
position:relative;
top:1px;
}
.cancelButton {
box-shadow:inset 0px 1px 0px 0px #cf866c;
background:linear-gradient(to bottom, #d0451b 5%, #bc XXXXXXXXXX%);
background-color:#d0451b;
border-radius:3px;
border:1px solid #942911;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size:13px;
padding:6px 24px;
text-decoration:none;
text-shadow:0px 1px 0px #854629;
}
.cancelButton:hover {
background:linear-gradient(to bottom, #bc3315 5%, #d0451b 100%);
background-color:#bc3315;
}
.cancelButton:active {
position:relative;
top:1px;
}
Assignment 2/webpage.html
Online Order Form
1. Operating System
Empty
Windows
Linux
2. Processo
Empty
Intel Core i5
Intel Core i7
AMD Ryzen
3. Memory
8 GB
16 GB
32 GB
64 GB
128 GB
4. Accessories
Battery backup
Webcam
Wireless mouse
Headset
Presentation clicke
5. Enter name
6. Enter email
7. Special instructions/Comments
Submit
Cancel