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.

My Cart

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!