Question

Write a program using the PHP application that will create a form for your favorite store....

Write a program using the PHP application that will create a form for your favorite store. The form should include fields for contact information and at least three(3) items to order from. It should calculate the order and display a subtotal before tax and a total after tax. Also add background color and pictures
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The html File:

<!DOCTYPE html>
<html>
<head>
<style>
div {
background-image: url('img_girl.jpg');    
}
body {
background-color: red;
}
</style>
   <title>Favorite Store</title>
  
   </head>
   <body>
   <form action="index.php" method='get'>
   <h2>Select Item for Purchase:</h2>
<input type="checkbox" name="choice[]" value= "1"/>T-Shirt ,Price: 10 USD<br/>
<input type="checkbox" name="choice[]" value= "2"/>Sweater ,Price: 20 USD<br/>
<input type="checkbox" name="choice[]" value= "3"/>Jeans ,Price: 30 USD<br/>
<input type="submit" value="Order">
</form>

</body>

</html>

index.php file code.

<!DOCTYPE html>
<html>
<head>

</head>

<body>

<?php
if(isset($_GET[choices])){
$clothes=4_GET["choices"];
$c= count($clothes);
$price=0.0;
$taxRate=20;
$tax=$price*$taxRate/100;
$totalprice=$price+$tax;

for($i=0;$i<$c;$i++){
if($clothes[$1]==1){
$price=$price + 10
echo"you have selected T-shirt<br>";
}
if($clothes[$1]==2){
$price=$price + 20
echo"you have selected Sweater<br>";
}
if($clothes[$1]==3){
$price=$price + 30
echo"you have selected Jeans<br>";
}
}
echo " subtotal before tax is: " .$price. "<br>";
echo " Total Price with tax is : " .$totalprice. "<br>;
}
else{
echo" Please select an item to purchase!";
}

?>
</body>
</html>

Add a comment
Know the answer?
Add Answer to:
Write a program using the PHP application that will create a form for your favorite store....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT