Code: Select all
<?php
}
function insert_order($order_details){
extract($order_details);
$delivery = $_SESSIONї'shipping'];
$name = $ship_name;
$title = $ship_title;
$surname = $ship_surname;
$address1 = $ship_address1;
$town = $ship_town;
$city = $ship_city;
$county = $ship_county;
$postcode = $ship_postcode;
$total = ($_SESSIONї'total_price']+$_SESSIONї'shipping']);
$customer_id = $_SESSIONї'customer_id'];
$link_id = db_connect();
$date = date('Y-m-d');
$query = "insert into orders (order_id, customer_id, order_status, date_order_placed, delivery_charge, ship_name, ship_surname,
ship_title, ship_address1, ship_address2, ship_city, ship_county, ship_postcode, order_note, total)
values(NULL, '$customer_id', 'Unprocessed orders', '$date', '$delivery','$name','$surname','$title','$address1',
'$town','$city','$county','$postcode', NULL,'$total')";
$result = mysql_query($query);
if (!$result)
return false;
}
?>Code: Select all
<?php
session_start(); //must start a session for cart
//$qty = $_GETї'qty'];
//checkout.php written by Manpreet Sandhu 26/01/2005
require('page.inc'); //page class
require_once('shopping_basket_fns.php');
$purchase = new Page();//create new page object
$purchase -> Display();//use function display from page class
display_main_menu(); //display side bar menu
//posted values from checkout_form().
//$ship_delivery = $_SESSIONї'shipping'];
$ship_name = $_POSTї'ship_name'];
$ship_title = $_POSTї'ship_title'];
$ship_surname = $_POSTї'ship_surname'];
$ship_address1 = $_POSTї'ship_address_1'];
$ship_town = $_POSTї'ship_town'];
$ship_city = $_POSTї'ship_city'];
$ship_county = $_POSTї'ship_county'];
$ship_postcode = $_POSTї'ship_postcode'];
//$total = ($_SESSIONї'total_price']+$_SESSIONї'shipping']);
//$customer_id = $_SESSIONї'customer_id'];
//if all values have been entered we can insert the order into the database
if(insert_order($_POST)!= false)
{
insert_order();
display_cart($_SESSIONї'cart'], false, 0);//display contents of cart
display_shipping(calculate_shipping_cost($items));//display total shipping cost
display_card_form();//display credit card form
}else
print 'Could not store data';
do_html_footer();
?>