Question
I have two files, one .php and the other .html together they create a form. The html form collects the info and the php code
I have two files, one .php and the other .html together they create a form. The html form collects the info and the php code collects the data and posts an output. Now I am supposed to combine them where the html and the php all one file named coffee_order.php. I am also supposed to make the form into a sticky form and the book does little to explain this please help.
Here are examples and my codes below:
Normal input example:
Error example:
My Code that needs combined and made into a sticky form:
coffee.html
The Coffee House
Order Form
coffee.php
array("name"=>"Boca Villa","price" =>7.99), "SBR" => array("name"=>"South Beach Rhythm","price" =>8.99), "PP" => array("name"=>"Pumpkin Paradise","price" =>8.99), "SS" => array("name"=>"Sumatran Sunset","price" =>9.99), "BB" => array("name"=>"Bali Batur","price" =>10.95), "DD" => array("name"=>"Double Dark","price" =>9.95) );
$qty = $_POST["quantity"]; $type = $_POST["type"]; $coffeeSel = ($coffee[($_POST["coffee"])])['name']; $coffeePrice = ($coffee[($_POST["coffee"])])['price'];
if ($type=="Decaffeinated"){ $coffeePrice = $coffeePrice+1; }
$total = $qty * $coffeePrice; $msg="";
if($coffeeSel=="select") $msg="Please select a coffee to be purchased.
";
if($type=="") $msg="Please select regular or decaffeinated.
";
if(!is_numeric($qty)) $msg.="Please enter a numeric value for quantity.
";
if(is_null($_POST["name"]) or empty($_POST["name"])) $msg.="Please enter a name.
";
if(is_null($_POST["email"]) or empty($_POST["email"])) $msg.="Please enter an email-address.
";
if(is_null($_POST["tnumber"]) or empty($_POST["tnumber"])) $msg.="Please enter a phone number.
";
if(is_null($_POST["address"]) or empty($_POST["address"])) $msg.="Please enter an address.
";
if(is_null($_POST["city"]) or empty($_POST["city"])) $msg.="Please enter a city.
";
if(is_null($_POST["state"]) or empty($_POST["state"])) $msg.="Please enter a state.
";
if(is_null($_POST["zip"]) or empty($_POST["zip"])) $msg.="Please enter a zip code.
";
if($msg==""){
?>
The Coffee House
Order Summary
Name: | |||||||||
Address: | |||||||||
City, State , Zip: | |||||||||
Telephone #: | |||||||||
E-mail: | |||||||||
Order Information | |||||||||
Coffee | Type | Quantity | Unit Cost | Total |
---|---|---|---|---|
".$msg."
"; } ?>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started