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
  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>
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'
  <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
  <input type='hidden' name='success_url'
  <input type='hidden' name='failure_url'
  <input type='hidden' name='cancel_url'
  <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>
    <td><select name =
    <td><input type = text name = card_number value = "" maxlength = 16
size = 40></td>
    <td>AMEX code (if required)</td>
    <td><input type = text name = amex_code value = "" maxlength = 4
size = 4></td>
    <td>Expiry Date</td>
    <td>Month <select name =
    Year <select name =
    <td>Name on Card</td>
    <td><input type = text name = card_name value = "<?=$name; ?>"
maxlength = 40 size = 40></td>
    <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
     <? display_form_button("purchase", "Purchase These Items"); ?>
As you can see the PHP code is just a  part of one larger page of
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/> 
Mobile +358 50 343 5159


Reply via email to