Hey Sxooter, I edited all my code to reflect the fact that I need to user lowercase in my cart script, but it is still displaying absolutely nothing.
<?php
$conn = pg_connect("dbname=regrowth") or die("Couldn't Connect ".pg_last_error());
include("functions.php");
//$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
//$s1 = mysql_connect($dbServer, $dbUser, $dbPass) or die(mysql_error());
//$d1 = mysql_select_db($dbName, $s1) or die(mysql_error());
/*$dbName2 = "thanato_regrowth02";
$s2 = mysql_connect($dbServer, $dbUser, $dbPass) or die(mysql_error());
$d2 = mysql_select_db($dbName, $s2) or die(mysql_error());
*/
switch($_GET["action"])
{
case "add_item":
{
AddItem($_GET["id"], $_GET["qty"]);
ShowCart();
break;
}
case "update_item":
{
UpdateItem($_GET["id"], $_GET["qty"]);
ShowCart();
break;
}
case "remove_item":
{
RemoveItem($_GET["id"]);
ShowCart();
break;
}
default:
{
ShowCart();
}
}
function ShowCart() // Display the users cart
{
// Session var shiptype equals the variable passed in the url
$_SESSION['shiptype'] = $_GET['shiptype'];
switch($_SESSION['shiptype']) // Depending on the shiptype, keep that shiptype selected
{
case "Express":
{
$eselected = "SELECTED";
$pselected = "";
$cselected = "";
break;
}
case "Priority":
{
$eselected = "";
$pselected = "SELECTED";
$cselected = "";
break;
}
case "EMS":
{
$eselected = "SELECTED";
$pselected = "";
$cselected = "";
break;
}
case "AirMail":
{
$eselected = "";
$pselected = "SELECTED";
$cselected = "";
break;
}
default:
{
$eselected = "";
$pselected = "SELECTED";
$cselected = "";
}
}
// Our cart query
$cartpsql = "SELECT * FROM cart INNER JOIN " . $_SESSION['table'] . " on cart.itemid = " . $_SESSION['table'] . ".itemid WHERE cart.cookieid = '" . GetCartId() . "' ORDER BY " . $_SESSION['table'] . ".itemid ASC";
$result = pg_query($conn, $cartpsql) or die(pg_last_error());
?>
<html>
<script language="JavaScript">
function getSelect(s) {
return s.options[s.selectedIndex].value
}
</script>
<body>
<form name="cartform" method="post" action="cart.php">
<select name="shipsel" OnChange="location=getSelect(this)">
<option <?php echo $cselected; ?> value="#"> Choose a shipping type</option>
<option <?php echo $eselected; ?> value="cart.php?shiptype=<?php echo $_SESSION['expressorems']; ?>"><?php echo $_SESSION['expressorems']; ?></option>
<option <?php echo $pselected; ?> value="cart.php?shiptype=<?php echo $_SESSION['prorair']; ?>"><?php echo $_SESSION['prorair']; ?></option>
</select>
</form>
<table>
<tr>
<th><font face="verdana" size="2" color="black">Quantity</font></th>
<th><font face="verdana" size="2" color="black">Name</font></th>
<th><font face="verdana" size="2" color="black">Price</font></th>
</tr>
</table>
</body>
</html>
<?php
while($row = pg_fetch_array($result) or die(pg_last_error()))
{
// Increment the total cost of all items
$totalCost += ($row["qty"] * $row["itemprice"]);
$totalWeight += ($row["qty"] * $row["itemweight"]);
$_SESSION['totalCost'] = $totalCost;
$_SESSION['totalWeight'] = $totalWeight;
if ($totalWeight < 16)
{
$emslookup=(ceil($totalWeight/8))* 8;
} else {
$emslookup=(ceil($totalWeight/16))* 16;
}
$_SESSION['emslookup'] = $emslookup;
if ($totalWeight < 16)
{
$explookup=(ceil($totalWeight/8))* 8;
} else {
$explookup=(ceil($totalWeight/16))* 16;
}
$_SESSION['explookup'] = $explookup;
if ($totalWeight < 8)
{
$airlookup=(ceil($totalWeight/1))* 1;
} else {
$airlookup=(ceil($totalWeight/4))* 4;
}
$_SESSION['airlookup'] = $airlookup;
$lookupinsurance=(ceil($totalCost/50))* 50;
$_SESSION['lookupinsurance'] = $lookupinsurance;
$priorlookup=(ceil($totalWeight/16))* 16;
$_SESSION['$priorlookup'] = $priorlookup;
if ($totalCost > 100)
{
$discountUR = $totalCost - 100;
$discountUR2 = $discountUR * 0.075;
$discountVar = (ceil($discountUR2/1))* 1;
}
if ($totalCost > 200)
{
$discountUR = 99 * 0.075;
$discountRnd2 = (ceil($discountUR/1))* 1;
$discountUR2 = $totalCost - 200;
$discountUR3 = $discountUR2 * 0.100;
$discountRnd = (ceil($discountUR3/1))* 1;
$discountVar = $discountRnd + $discountRnd2;
}
/*
echo "(" . $discountUR . ")";
echo "(" . $discountUR2 . ")";
echo "(" . $discountRnd . ")";
echo "(" . $discountVar . ")";
*/
$iresult = pg_query("SELECT * FROM us_priority_insurance WHERE coverage = " . number_format($lookupinsurance, 2, ".", ",") . "") or die(pg_last_error());
$emsresult = pg_query("SELECT cost FROM foreign_ems WHERE weight = '$emslookup' AND emszone = '" . $_SESSION['emszone'] ."'") or die(pg_last_error());
$airresult = pg_query("SELECT cost FROM foreign_letterpost WHERE weight = '$airlookup' AND priority = '" . $_SESSION['airprior'] . "'") or die(pg_last_error());
$expresult = pg_query("SELECT cost FROM us_express WHERE weight = '$explookup'") or die(pg_last_error());
$priorresult = pg_query("SELECT cost from us_prioritymail WHERE weight = '$priorlookup'") or die(pg_last_error());
if ($_SESSION['shiptype'] == "EMS")
{
$shipresult = $emsresult;
} elseif ($_SESSION['shiptype'] == "AirMail") {
$shipresult = $airresult;
} elseif ($_SESSION['shiptype'] == "Express") {
$shipresult = $expresult;
} elseif ($_SESSION['shiptype'] == "Priority") {
$shipresult = $priorresult;
}
?>
<html>
<script>
function UpdateQty(item)
{
stype = "<?php echo $_SESSION['shiptype']; ?>";
itemId = item.name;
newQty = item.options[item.selectedIndex].text;
document.location.href = 'cart.php?action=update_item&id='+itemId+'&qty='+newQty+'&shiptype='+stype;
}
</script>
<body>
<table>
<tr>
<td width="15%" height="25">
<font face="verdana" size="1" color="black">
<select name="<?php echo $row["itemid"]; ?>" onChange="UpdateQty(this)">
<?php
for($i = 1; $i <= 20; $i++)
{
echo "<option ";
if($row["qty"] == $i)
{
echo " SELECTED ";
}
echo ">" . $i . "</option>";
}
?>
</select>
</font>
</td>
</tr>
<td width="55%" height="25">
<font face="verdana" size="1" color="black">
<?php
echo $row["itemname"];
?>
</font>
</td>
<td width="20%" height="25">
<font face="verdana" size="1" color="black">
$<?php echo number_format($row["itemprice"], 2, ".", ",");
?>
</font>
</td>
<td width="10%" height="25">
<font face="verdana" size="1" color="black">
<a href="cart.php?action=remove_item&id=<?php echo $row["itemid"]; ?>&shiptype=<?php echo $_SESSION['shiptype']; ?>">Remove</a>
</font>
</td>
<tr>
<td width="100%" colspan="4">
<hr size="1" color="blue" NOSHADE>
</td>
</tr>
<tr>
<td width="40%" colspan="2">
<font face="verdana" size="1" color="black">
<a href="product.php?country=<?php echo $_SESSION['country']; ?>&cartid=<?php echo GetCartId(); ?>"><< Keep Shopping</a>
</font>
</td>
</tr>
<tr>
<td width="40%" colspan="2">
<font face="verdana" size="2" color="black'">
</font>
</tr>
</td>
</table>
</body>
</html>
<?php
echo "Sub Total: $" . number_format($_SESSION['totalCost'], 2, ".", ",") . "<br>";
echo "Discount: $" . number_format($discountVar, 2, ".", ",") . "<br>";
// echo "Adjusted Total: $" . number_format($_SESSION['totalCost'] - $discountVar, 2, ".", ",") . "<br>";
/*
//echo "Sub Total: $" . number_format($_SESSION['totalCost'], 2, ".", ",") . "<br>";
echo "Shipping: $";
while ($srow = pg_fetch_array($shipresult) or die(pg_last_error()))
{
echo $srow[cost] . "<br>";
echo "Total: $". number_format($srow[cost] + $_SESSION['totalCost'] - $discountVar, 2, ".", ",");
}
while ($irow = pg_fetch_array($iresult) or die(pg_last_error()))
{
echo $st . "<br> Insurance: $";
echo $irow[rate];
}
*/
}
}
?>