I am having difficulty passing details to a form. 
I need to somehow pass a variable cost to a form. 
The cost is made up of items in a cart (details taken from a Mysql DB)
and a shipping cost. I then have a function written to display the
credit card form (which needs to be passed to a secure server below the
final cost  (ie cost plus shipping). I have tried without success most
of this morning to pass the final cost plus shipping to the form hidden
field (which is on the same html page!) Here is the section of code I am
having problems with. I will supply the rest of the functions to anyone
who thinks they can help but it's a lot of code.
 
 
 
<?
}
 
function display_shipping($shipping)
{
  // display table row with shipping cost and total price including
shipping
  global $total_price;
?>
  <table border = 0 width = 760 cellspacing = 0>
  <tr><td align = left>Shipping</td>
      <td align = right> <?=number_format($shipping, 2); ?></td></tr>
  <tr><th bgcolor="#146190" align = left>TOTAL INCLUDING SHIPPING</th>
      <th bgcolor="#146190" align = right>
<?=number_format($shipping+$total_price, 2); ?></th>
  </tr>
  </table><br>
<?
}
 
function display_card_form($name)
{
  //display form asking for credit card details
?>
  <table border = 0 width = 760 cellspacing = 0>
 
  <form action ='https://spos.luottokunta.fi/pm/servlet/Payment'
method='post'>
  <input type='hidden' name='version' value='1.2'>
  <input type='hidden' name='merchant_rn' value='8058950'>
  <input type='hidden' name='order_rn' value='10001'>
  <input type='hidden' name='amount' value=''>
  <input type='hidden' name='amount_exp' value='-2'>
  <input type='hidden' name='currency' value='978'>
  <input type='hidden' name='order_description' value='Viola test
product'>
  <input type='hidden' name='success_url'
value='http://www.violasystems.com'>
  <input type='hidden' name='failure_url'
value='http://www.violasystems.com/bazaar'>
  <input type='hidden' name='cancel_url'
value='http://www.violasystems.com/privacy.php'>
  <input type='hidden' name='trans_method' value='0'>
  <input type='hidden' name='mac' value='F529BC531D'>
  <tr><th colspan = 2 bgcolor="#cccccc">Credit Card Details</th></tr>
  <tr>
    <td>Type</td>
    <td><select name =
card_type><option>VISA<option>MasterCard</select></td>
  </tr>
  <tr>
    <td>Number</td>
    <td><input type = text name = card_number value = "" maxlength = 16
size = 40></td>
  </tr>
  <tr>
    <td>AMEX code (if required)</td>
    <td><input type = text name = amex_code value = "" maxlength = 4
size = 4></td>
  </tr>
  <tr>
    <td>Expiry Date</td>
    <td>Month <select name =
card_month><option>01<option>02<option>03<option>04<option>05<option>06<
option>07<option>08<option>09<option>10<option>11<option>12</select>
    Year <select name =
card_year><option>00<option>01<option>02<option>03<option>04<option>05<o
ption>06<option>07<option>08<option>09<option>10</select></td>
  </tr>
  <tr>
    <td>Name on Card</td>
    <td><input type = text name = card_name value = "<?=$name; ?>"
maxlength = 40 size = 40></td>
  </tr>
  <tr>
    <td colspan = 2 align = center>
      <b>If you press purchase your credit card details will be
transmitted via a secure
   server, your details processed and then you will be redirected to our
site.</b>
     <? display_form_button("purchase", "Purchase These Items"); ?>
    </td>
  </tr>
  </table>
  
 
<?
 
As you can see the PHP code is just a  part of one larger page of
functions.
What I am trying to do is pass the
<?=number_format($shipping+$total_price, 2); ?> to the amount hidden
field in the form.
Any ideas?
This is not all my code which is why I am having problems.

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com <http://www.violasystems.com/> 
[EMAIL PROTECTED]
Mobile +358 50 343 5159



 

Reply via email to