PHP Code:
<?
require_once("dbconnection.php");
require_once("header.php");
$st = explode("|", $aset[SalesTax]);
$SalesTaxValue = number_format($st[0], 2, ".", "");
$SalesTaxClause = "<span class=SalesTax><center>$SalesTaxValue % Sales Tax will be calculated to $st[1] State residence only.</center></span>";
$city_list_1 = explode(',','California,Arizona,New Mexico,Colorado,Utah,Nevada,Wyoming,Idaho,Oregon,Washington,Montana');
$city_list_2 = explode(',','North Dakota,South Dakota,Minnesota,Wisconsin,Iowa,Nebraska,Illinois,Missouri,Kansas,Oklahoma,Ark ansas,Texas,Louisiana');
$city_list_3 = explode(',','Michigan,Indiana,Ohio,Kentucky,Tennessee,Mississippi,Alabama,Georgia,Florida, South Carolina,North Carolina,Virginia,West Virginia,Pennsylvania,Maryland,Delaware,Dist Columbia,New Jersey,New York,Connecticut,Rhode Island,Massachusetts,New Hampshire,Vermont,Maine');
$city_list_4 = explode(',','Hawaii,Alaska');
//show order content
$q1 = "select * from orders_content where OrderID = '$PHPSESSID' ";
$r1 = mysql_query($q1) or die(mysql_error());
if($_POST[st_state] == $_POST[BillingState])
{
$NewSalesTax = number_format($_POST[ftotal] * $_POST[st_value]/100, 2, ".", "");
$NewTotal = number_format($_POST[ftotal] + $NewSalesTax, 2, ".", "");
$content1 = "Because of the sales tax calculation, your new order total is $ $NewTotal";
}
if(in_array($_POST['ShippingState'],$city_list_1))
{
$ZoneShipping = @$_POST['ShippingTotal'];
echo 'User\'s City Found in city_list_1 Array';
}
else if(in_array($_POST['ShippingState'],$city_list_2))
{
$ZoneShipping = @$_POST['ShippingTotal2'];
echo 'User\'s City Found in city_list_2 Array';
}
else if(in_array($_POST['ShippingState'],$city_list_3))
{
$ZoneShipping = @$_POST['ShippingTotal3'];
echo 'User\'s City Found in city_list_3 Array';
}
else if(in_array($_POST['ShippingState'],$city_list_4))
{
$ZoneShipping = @$_POST['ShippingTotal4'];
echo 'User\'s City Found in city_list_4 Array';
}
else
{
echo 'User\'s City Not Found in Any List of Cities';
}
while($a1 = mysql_fetch_array($r1))
{
if($col == "1c1c1c")
{
$col = "1c1c1c";
}
else
{
$col = "1c1c1c";
}
$ItemPrice = number_format($a1[ItemPrice], 2, ".", "");
$MyShipping = number_format($a1[ItemQty] * $ZoneShipping, 2, ".", "");
$ItemTotal = number_format($a1[ItemPrice] * $a1[ItemQty], 2, ".", "");
$content .= "<tr bgcolor=$col>\n\t<td>$a1[ItemName]</td>\n\t<td align=right>$ $ItemPrice</td>\n\t<td align=center>$a1[ItemQty]</td>\n\t<td align=right>$ $ItemTotal</td></tr>\n";
$ShippingTotal = number_format($ShippingTotal + $MyShipping, 2, ".", "");
$OrderTotal1 = number_format($OrderTotal1 + $ItemTotal, 2, ".", "");
}
$OrderTotal = number_format($OrderTotal1 + $ShippingTotal, 2, ".", "");
{
$NewSalesTax = "0.00";
$NewTotal = $_POST[ftotal];
}
while($a1 = mysql_fetch_array($r1))
{
if($col == "1c1c1c")
{
$col = "1c1c1c";
}
else
{
$col = "1c1c1c";
}
$ItemPrice = number_format($a1[ItemPrice], 2, ".", "");
$MyShipping = number_format($a1[ItemQty] * $ZoneShipping, 2, ".", "");
$ItemTotal = number_format($a1[ItemPrice] * $a1[ItemQty], 2, ".", "");
$content .= "<tr bgcolor=$col>\n\t<td>$a1[ItemName]</td>\n\t<td align=right>$ $ItemPrice</td>\n\t<td align=center>$a1[ItemQty]</td>\n\t<td align=right>$ $ItemTotal</td></tr>\n";
$ShippingTotal = number_format($ShippingTotal + $MyShipping, 2, ".", "");
$OrderTotal1 = number_format($OrderTotal1 + $ItemTotal, 2, ".", "");
}
$OrderTotal = number_format($OrderTotal1 + $ShippingTotal, 2, ".", "");
$today = time();
$q1 = "insert into orders set
SubTotal = '$OrderTotal1',
ShippingPrice = '$_POST[ShippingPrice]',
SalesTax = '$NewSalesTax',
OrderTotal = '$NewTotal',
ShipToFirstName = '$_POST[FirstName]',
ShipToLastName = '$_POST[LastName]',
ShipToAddress1 = '$_POST[ShippingAddress1]',
ShipToAddress2 = '$_POST[ShippingAddress2]',
ShipToCity = '$_POST[ShippingCity]',
ShipToCountry = '$_POST[ShippingCountry]',
ShipToState = '$_POST[ShippingState]',
ShipToPhone = '$_POST[ShippingPhone]',
ShipToZIP = '$_POST[ShippingZip]',
BillToFirstName = '$_POST[ch1]',
BillToLastName = '$_POST[ch2]',
BillToAddress1 = '$_POST[BillingAddress1]',
BillToAddress2 = '$_POST[BillingAddress2]',
BillToCity = '$_POST[BillingCity]',
BillToState = '$_POST[BillingState]',
BillToCountry = '$_POST[BillingCountry]',
BillToZIP = '$_POST[BillingZip]',
BillToPhone = '$_POST[BillingPhone]',
ClientEmail = '$_POST[YourEmail]',
OrderDate = '$today' ";
mysql_query($q1) or die(mysql_error());
//get the OrderID
$q1 = "select last_insert_id()";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);
mysql_query("update orders_content set OrderID = '$a1[0]' where OrderID = '$PHPSESSID' ") or die(mysql_error());
require_once("templates/PaymentTemplate.php");
require_once("footer.php");
?>
I did not get anything for shipping and it didnt echo anything out .
Bookmarks