Question: Use the php and html below to configure the shipping and billing info once the customer has items in their cart. My Cart /*this does
Use the php and html below to configure the shipping and billing info once the customer has items in their cart.
/*this does the hovering*/
body { font-family: arial, helvetica, sans-serif; }
a.nodec { text-decoration: none; }
a:hover { text-decoration: underline; }
li em { font-weight: bold; }
ul {
margin-left: 20px;
width: 60%;
display: inline-block;
text-align: right;
float: right;
margin-top:-5%;
}
ul ul { font-size: .8em; }
ul li {
display: inline-block;
height: 60px;
}
ul li a{
padding: 20px;
background: red;
color: purple;
}
div.box {
background-color:gray;
/*box-shadow: 2px 2px 1px lightgray;*/
border: 5px #ccc;
padding: 2%;
margin: 5%;
}
#footer{
text-align:right;
border-bottom: 1px #ccc solid;
}
h2 {color:purple;}
body {background:gray;}
/*for the search engine*/
/*might still need to go through this 1 and change the appearance*/
/*box around the search engine*/
#tfheader{
background-color:gray;
}
/*makes the search engine appear on the left side of the screen*/
#tfnewsearch{
float:left;
padding:20px;
}
.tftextinput{
margin: 0;
width:400px;
padding: 5px 15px;
font-family: Arial, Helvetica, sans-serif;
font-size:14px;
border:1px solid #0076a3; border-left:0px;
border-top-right-radius: 5px 5px;
border-bottom-right-radius: 5px 5px;
}
.tfbutton {
margin: 0;
float:left;
padding: 5px 15px;
font-family: Arial, Helvetica, sans-serif;
font-size:14px;
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
color: #ffffff;
border: solid 1px #0076a3; border-right:0px;
background: #0095cd;
background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5));
background: -moz-linear-gradient(top, #00adee, #0078a5);
border-top-right-radius: 5px 5px;
border-bottom-right-radius: 5px 5px;
}
.tfbutton:hover {
text-decoration: none;
background: #007ead;
background: -webkit-gradient(linear, left top, left bottom, from(#0095cc), to(#00678e));
background: -moz-linear-gradient(top, #0095cc, #00678e);
}
/* Fixes submit button height problem in Firefox */
.tfbutton::-moz-focus-inner {
border: 0;
}
.tfclear{
clear:both;
}
Cart
- Home
- About
- Contact
- My Account
My Cart
Here are the items in your cart!
Please enter your Shipping and Billing information below.
Shipping Information
First Name:
Last Name:
Address:
City:
State:
Zip:
Phone Number:
Billing Information
Same as shipping address
First Name:
Last Name:
Address:
City:
State
Zip:
Phone Number:
Payment
First Name:
Last Name:
Credit Card Number:
CVV:
_______________________________
//ordering.php
//defining our database here & basically "logging on" to our database
//getting confused on which one is the user and which is the name of the database
$DB_Name = 'cs4920S2017P1'; //name of our database; think this is the correct one
$DB_User = 'cs4920S2017P1'; //user
$DB_Password = 'tempPWDP1';
$DB_Host = 'math-cs.ucmo.edu'; //think this is the right host...
//storing into a variable
$link = mysql_connect(DB_Host, DB_User, DB_Password);
//killing process if the variable doesn't working/the test fails
if (!$link){
die('No connection available' . mysql_error());
} //end of if
//actually selecting the database I'm working with
$db_selected = mysql_select_db)(DB_Name, $link);
//killing process if the variable doesn't working/the test fails
if(!$db_selected){
die('Cannot use database' . DB_Name . ':' . mysql_error());
} //end of if
//reinforcing that there was a successful connection to the database
echo 'Connection successful';
//retrieving information added to each
$firstName = $_POST['First_Name'];
$lastName = $_POST['Last_Name'];
$phoneNumber = $_POST['Phone_Number'];
$shippingAddress = $_POST['Shipping_Address'];
$shippingCity = $_POST['Shipping_City'];
$shippingState = $_POST['Shipping_State'];
$shippingZip = $_POST['Shipping_Zip'];
$billingAddress = $_POST['Billing_Address'];
$billingCity = $_POST['Billing_City'];
$billingState = $_POST['Billing_State'];
$billingZip = $_POST['Billing_Zip'];
$creditCardNumber = $_POST['Credit_Card_Number'];
$creditCardCVV = $_POST['Credit_Card_CVV'];
//inserting the information into the database
//insert into the table; identify what field in the ()
$sqlFName = "INSERT INTO customer(First_Name) VALUES ('$firstName')";
$sqlLName = "INSERT INTO customer(Last_Name) VALUES ('$lastName')";
$sqlPNum = "INSERT INTO customer(Phone_Number) VALUES ('$phoneNumber')";
$sqlSAddress = "INSERT INTO customer(Shipping_Address) VALUES ('$shippingAddress')";
$sqlSCity = "INSERT INTO customer(Shipping_City) VALUES ('$shippingCity')";
$sqlSState = "INSERT INTO customer(Shipping_State) VALUES ('$shippingState')";
$sqlSZip = "INSERT INTO customer(Shipping_Zip) VALUES ('$shippingZip')";
$sqlBAddress = "INSERT INTO customer(Billing_Address) VALUES ('$billingAddress')";
$sqlBCity = "INSERT INTO customer(Billing_City) VALUES ('$billingCity')";
$sqlBState = "INSERT INTO customer(Billing_State) VALUES ('$billingState')";
$sqlBZip = "INSERT INTO customer(Billing_Zip) VALUES ('$billingZip')";
$sqlCCNum = "INSERT INTO customer(Credit_Card_Number) VALUES ('$creditCardNumber')";
$sqlCCCVV = "INSERT INTO customer(Credit_Card_CVV) VALUES ('$creditCardCVV')";
//checking to see if the sql inserting info worked
//didn't think i made a mysql_query yet....
//do i have to do one for each???
if(!mysql_query($sqlFName)){
die('Error:' . mysql_error());
} //end of if
if(!mysql_query($sqlLName)){
die('Error:' . mysql_error());
} //end of if
mysql_close();
?>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
