I am trying to get the grand total in this line <input type=”hidden” name=”amount” value=”90″> instead of 90 this is the payment form that goes to worldpay and needs the grand total
[code=php]
<?php
include_once(“dbfiles/db1.php”);
$vendor = ‘wizardmotorcycl’;
$key = ‘1056199’;
$live = 100;
function sagepayform($orderid) {
global $vendor,$key,$live;
$_SESSION[‘orderID’] = $orderid;
if ($live) $vspsite=”https://secure-test.worldpay.com/wcc/purchase”;
else $vspsite=”https://secure-test.worldpay.com/wcc/purchase”;
$sql = “SELECT * FROM orders1 WHERE id='{$orderid}'”;
$result = mysql_query($sql) or die(‘ERROR:: ‘.$sql.'<br><br>’.mysql_error());
$sql2 = “SELECT * FROM config WHERE config_id=1”;
$result2 = mysql_query($sql2) or die(‘ERROR:: ‘.$sql.'<br><br>’.mysql_error());
if (mysql_num_rows($result)==1 && mysql_num_rows($result2)==1) {
$order = mysql_fetch_assoc($result);
$config = mysql_fetch_assoc($result2);
$data = array(
‘VendorTxCode’=>$order[‘id’],
‘Amount’=>number_format($order[‘grandtotal’],2,”.”,””),
‘Currency’=>’GBP’,
‘Description’=>$config[‘store_name’].’ Order’,
‘SuccessURL’=>’http://’.$_SERVER[‘HTTP_HOST’].str_replace(‘checkout’,’transok’,$_SERVER[‘REQUEST_URI’]),
‘FailureURL’=>’http://’.$_SERVER[‘HTTP_HOST’].str_replace(‘checkout’,’transnotok’,$_SERVER[‘REQUEST_URI’]),
‘CustomerEmail’=>$order[’email’],
‘VendorEmail’=>$config[‘store_owner_email_address’],
‘CustomerName’=>$order[‘title’].” “.$order[‘forename’].” “.$order[‘surname’],
‘DeliveryAddress’=>$order[‘d_street_address1’].” “.$order[‘d_street_address2’],
‘DeliveryPostCode’=>$order[‘postcode’],
‘BillingAddress’=>$order[‘cardaddress’],
‘BillingPostCode’=>$order[‘cardpostcode’],
‘ContactNumber’=>$order[‘dayphone’]
);
$crypt = base64Encode(SimpleXor(formatData($data),$key));
?>
<form action=’https://secure-test.worldpay.com/wcc/purchase’ method=post>
<input type=’hidden’ name=’instId’ value=’1056199’/>
<input type=”hidden” name=”amount” value=”90″>
<input type=’hidden’ name=’cartId’ value=’id’/>
<input type=’hidden’ name=’currency’ value=’GBP’/>
<input type=’hidden’ name=’testMode’ value=’100’/>
<input type=’submit’ value=’Submit Form’/>
<script>
window.onload=function() {
setTimeout(“document.SagePay.submit()”,3000);
}
</script>
</form>
<?php