As i did with paypal i'm having problems passing the total value in the nochex checkout form.
The form looks like this:
<form action="https://secure.nochex.com/" method="POST">
<input type="hidden" name ="email" value="zar786@gmail.com">
<input type="hidden" name ="amount" value="<?php echo $_GET ['.$total.']; ?>">
<input type="hidden" name ="logo" value="http://zardvds.890m.com/images/logo.gif ">
<input type="hidden" name ="returnurl" value="http://zardvds.890m.com/ "
I call a showCart function from which i need to pass the $total variable, the function looks like this:
function showCart() {
global $db;
$cart = $_SESSION['cart'];
if ($cart) {
$items = explode(',',$cart);
$contents = array();
foreach ($items as $item) {
$contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;
}
$output[] = '<form action="cart.php?action=update" method="post" dvd_id="cart">';
$output[] = '<table>';
$output[] = '<tr>';
$output[] = '<td><b>Title: </b></td>';
$output[] = '<td><b>Price: </b></td>';
$output[] = '<td><b>Quantity: </b></td>';
$output[] = '<td><b>Overall: </b></td>';
$output[] = '<td></td>';
$output[] = '</tr>';
foreach ($contents as $dvd_id=>$qty) {
$sql = 'SELECT * FROM dvds WHERE dvd_id = '.$dvd_id;
$result = $db->query($sql);
$row = $result->fetch();
extract($row);
$output[] = '<tr>';
$output[] = '<td><a href="dvd_details.php?dvd_id='.$dvd_id.'" class="r">'.$title.'</a></td>';
$output[] = '<td>£'.$price.' </td>';
$output[] = '<td><input type="text" name="qty'.$dvd_id.'" value="'.$qty.'" size="2" maxlength="2" /> </td>';
$output[] = '<td>£'.($price * $qty).' </td>';
$total += $price * $qty;
$output[] = '<td><a href="cart.php?action=delete&dvd_id='.$dvd_id.'" class="r">Remove</a></td>';
$output[] = '</tr>';
}
$output[] = '</table>';
$output[] = '<p><b>Grand total:</b> £'.$total.'</p>';
$output[] = '<div><input type="image" src="./images/update.gif" name="submit" value="Submit"></div>';
$output[] = '</form>';
} else {
$output[] = '<p>You shopping cart is empty.</p>';
}
return join('',$output);
}
?>
If i try passing the dvd_id instead it works, but i can't get it to pass the value of the total, does anyone know where i might be going wrong?