am using a script from paypal to integrate a shopping cart in my site
and am trying to get the data from it to use it my database
but frankly i have no idea about javascript and got lost
can anyone tell me how to get it as variable to use it later
this is the html form
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml"
      xml:lang = "en">
<head>

</head>

<body>

<script type = "text/javascript"
        src  = "cart1.js">
</script>
<script type = "text/javascript"
        src  = "set.js">
</script>

<form action = "javascript: void (0);"
      method = "post">
<p>
<img src   = "your.gif" 
     alt   = "your logo" />

<table cellspacing = "0"
       cellpadding = "3"
       border      = "4"
       width       = "100%"
       frame       = "box"
       rules       = "all"
       summary     = "This table depicts a common shopping cart format.  It has several columns and as many rows as the user entered in his order form.  At the bottom the prices are summarized, and additional charges such as shipping and handling are included.">

<caption><h2>THIS IS YOUR SHOPPING CART</h2>
</caption>

  <tr align = "right">
    <th>Del</th>

    <th>Qty</th>
<script type="text/javascript">
<!--
LoadIt ();
  if (root.xx_pc == on) document.writeln ('    <th>Cat</th>');
//-->
</script>
    <th align = "left">Code</th>
    <th align = "left">Description</th>
    <th>Each</th>
    <th>Total</th>

<script type="text/javascript">
<!--
  if (root.xx_wt == on) {
    if (root.xx_wtent == "gm") {
      document.writeln ('<th>gm</th>');
      document.writeln ('<th>Tgm</th>');
    } else {
      document.writeln ('<th>oz</th>');
      document.writeln ('<th>Toz</th>');
    }
  }
  if (root.xx_img == on) {
    document.writeln ('<th style="text-align :center">Images</th>');
  }
//-->
</script>
  </tr>

<script type = "text/javascript">
<!--
  PrintCart ();
  if (!window.opener.closed)
    LoadTots (window.opener.document.forms);
//-->
</script>

  <tr align = "right">
<script type="text/javascript">
<!--
  if (root.xx_pc == on) document.writeln ('    <td colspan = "6">');
  else                  document.writeln ('    <td colspan = "5">');
//-->
</script>
<b>Subtotal</b>
    </td>

    <td>
<script type = "text/javascript">
<!--
  document.write (Dollar (tprc));
//-->
</script>
    </td>

<script type="text/javascript">
<!--
  if (root.xx_wtent == "gm")
    wte = Math.ceil (tozs*1.0 / root.xx_wtrup) * root.xx_wtrup;
  else
    wte = Math.ceil (tozs / 16);  // always round up to pounds
  if (root.xx_wt == on) {         // display weights?
    document.writeln ('    <td colspan = "2">');
    if (root.xx_wtent == "gm") {
      if (wte >= 1000)      // change to kg
        document.writeln ('Kgs&nbsp;=&nbsp;', wte/1000);
      else
        document.writeln ('gms&nbsp;=&nbsp;', wte);
    }
    else
      document.writeln ('Lbs&nbsp;=&nbsp;', wte);
    document.writeln ('    </td>');
  }
//-->
</script>

  </tr>

<script type="text/javascript">
<!--
if (hand > 0) {  // only show if something there
  document.writeln ('<tr>');
  if (root.xx_pc == on) document.writeln ('  <td colspan = "5">');
  else                  document.writeln ('  <td colspan = "4">');
  document.writeln ('Cart-wide handling charges - ',
                    '  </td>',
                    '  <td align = "right">',
                    '<b>Hand</b>',
                    '  </td>',
                    '  <td align = "right">',
                    Dollar (hand),
                    '  </td>',
                    '</tr>');
}
//-->
</script>

<script type="text/javascript">
<!--
if (root.xx_gwbx == on) {  // only show if something there
  document.writeln ('<tr>');
  if (root.xx_pc == on) document.writeln ('  <td colspan = "5">');
  else                  document.writeln ('  <td colspan = "4">');
  document.writeln ('Gift Wrapping Charges - ',
                    '  </td>',
                    '  <td align = "right">',
                    '<b>gift wrap</b>',
                    '  </td>',
                    '  <td align = "right">',
                    Dollar (gwtot*tqty),
                    '  </td>',
                    '</tr>');
}
//-->

</script>

<script type="text/javascript">
<!--
if (ttax > 0) {
  document.writeln ('<tr>');
  if (root.xx_pc == on) document.writeln ('  <td colspan = "5">');
  else                  document.writeln ('  <td colspan = "4">');
  document.writeln ('Cart-wide tax charges - ',
                    ttxt,
                    '  </td>',
                    '  <td align = "right">',
                    '<b>Tax</b>',
                    '  </td>',
                    '  <td align = "right">',
                    Dollar (ttax),
                    '  </td>',
                    '</tr>');
}
//-->
</script>

<script type="text/javascript">
<!--
if (qtyd > 0) {
  document.writeln ('<tr>');
  if (root.xx_pc == on) document.writeln ('  <td colspan = "5">');
  else                  document.writeln ('  <td colspan = "4">');
  document.writeln ('Cart-wide quantity discounts - ',
                    'Qty = ', tqty,
                    '  </td>',
                    '  <td align = "right">',
                    '<b>Dis</b>',
                    '  </td>',
                    '  <td align = "right">',
                    '-', Dollar (qtyd),
                    '  </td>',
                    '</tr>');
}
//-->
</script>

<script type="text/javascript">
<!--
if (insu > 0) {
  insx = CalcInsu (tprc);
  document.writeln ('<tr>');
  if (root.xx_pc == on) document.writeln ('  <td colspan = "5">');
  else                  document.writeln ('  <td colspan = "4">');
  document.writeln ('Insurance - $',
                    Dollar (tprc),
                    '  </td>',
                    '  <td align = "right">',
                    '<b>Insu</b>',
                    '  </td>',
                    '  <td align = "right">',
                    Dollar (insx),
                    '  </td>',
                    '</tr>');
}
//-->
</script>

<script type="text/javascript">
<!--
if (ship > 0 || root.xx_ship == on) {
  document.writeln ('<tr>');
  if (root.xx_pc == on) document.writeln ('  <td colspan = "5">');
  else                  document.writeln ('  <td colspan = "4">');
  document.writeln ('Shipping Charges. ', root.stxt0,
                    '  </td>',
                    '  <td align = "right">',
                    '<b>Shipping</b>',
                    '  </td>',
                    '  <td align = "right">',
                    Dollar (ship),
                    '  </td>',
                    '</tr>');
}
  document.writeln ('  <tr align="center">');
  if (root.xx_pc == on) document.writeln ('    <td colspan = "5">');
  else                  document.writeln ('    <td colspan = "4">');
//-->
</script>

&nbsp;
  <input type    = "button" 
         value   = "Checkout" 
         onclick = "if (ChkOpts ()) 
           document.forms.ppform.submit ();" />

&nbsp; 
  <input type    = "button" 
         value   = "Continue Shopping" 
         onclick = "window.close();" />
&nbsp;
  <input type    = "button" 
         value   = "Clear Cart" 
         onclick = "ClearCart ();
                    location.reload();" />
    </td>

    <td align = "right">
<b>Tot</b>
<script type="text/javascript">
<!--
  if (root.xx_cur.length > 0)
    document.writeln (" (", root.xx_cur, ")");
//-->
</script>
    </td>

    <td align = "right">
<script type = "text/javascript">
<!--
  document.write (Dollar (gtot));
//-->
</script>
    </td>

  </tr>

</table>

<br />

<script type="text/javascript">
<!--
  if (root.xx_gwbx == on) { // check gift wrapping
    document.writeln (
'<input type="checkbox" name="gwbx"');
    if (gwtot > 0) document.write (' checked');
    document.writeln (
'  onclick="if (this.form.gwbx.checked)',
'             gwtot = root.xx_gwcg;',
'           else gwtot = 0;',
'           root.gwtot = gwtot;',
'           root.store ();',
'           document.location.reload ();" />',
' I want the items giftwrapped. (', Dollar (root.xx_gwcg), 
' per item)',
'            <br /><br />');
  }
//-->
</script>

<script type="text/javascript">
<!--
  if (root.xx_chkbx == on && root.chkby == off) { // check agreement
    document.writeln (
'<input type="checkbox" name="chkbx"',
'  onclick="root.chkby = on;',
'           root.store ();',
'           document.location.reload ();" />',
' I agree with all terms and conditions.',
'            <br /><br />');
  }
//-->
</script>

<script type="text/javascript">
<!--
  if (root.xx_coup == on) {  // try to get coupon
    document.writeln ('Enter your coupon code (&quot;xcoup1&quot;) - ',
                      '  <input type  = "text"',
                      '         size  = "12"',
                      '         onchange = "coupval = this.value;" />',
                      '&nbsp; ',
                      '  <input type    = "button" ',
                      '         value   = "Check Code"',
                      '         onclick = "ChkCoup ();" />',
                      '<br /><br />');
  }
//-->
</script>

<script type="text/javascript">
<!--
  if (root.xx_tax == on) {  // ask for tax?
    document.writeln ('<select onchange="SetCartTX (this);">',
                      '  <option selected>Tax Rates</option>',
                      '  <option value="15">Ontario (15%)</option>',
                      '  <option value="7.50">Canada (7.5%)</option>',
                      '  <option value="0">Non-Canada (0%)</option>',
                      '</select>',
                      '<br /><br />');
  } else {
    root.stax = 0;  // so we don't get prompt
  }
//-->
</script>

<script type="text/javascript">
<!--
  if (root.xx_ship == on) {  // ask for shipping?
    document.writeln ('<select onchange = "Shipper (this);">',
                      '  <option selected>Select/Modify Shipping</option>',
                      '  <option>WILL PICK UP</option>',
                      '  <option>West-coast ($1.00) Insured ($1 + 2%)</option>',
                      '  <option>Midwest ($2.00)</option>',
                      '  <option>East-coast ($3.00)</option>',
                      '  <option>Canada ($4.00)</option>',
                      '  <option>Mexico ($5.00)</option>',
                      '  <option>Other International ($21.00 base)</option>',
                      '  <option>$2.00 per pound</option>',
                      '</select>',
                      '<br /><br />');
  } else {
    if (root.sv0 == 0) SetAmtSH (0, 0, 0);  // zap any shipping
  }
//-->
</script>

<script type="text/javascript">
<!--
  if (root.xx_sum == on) {  // display product category summaries
    for (var i=0; i<cats; i++) {
      if (ctot["q" + i] == 0) continue;  // skip empty cats
      document.writeln ("Category ", i, " quantity total = ",
                         ctot["q" + i], "<br />");
      document.writeln (" amount total &nbsp;= ",
                         Dollar (ctot["a" + i]), "<br />");
      document.writeln (" shipping total = ",
                         Dollar (ctot["s" + i]), "<br />");
      document.writeln (" handling total = ",
                         Dollar (ctot["h" + i]), "<br />");
      document.writeln (" discount total = ",
                         Dollar (ctot["d" + i]), "<br />");
      document.writeln (" weight total = ",
                         ctot["w" + i], "<br /><br />");
    }
  }
//-->
</script>

<script type="text/javascript">
<!--
  if (root.xx_cc == on) {  // do we display the credit card stuff?
    document.writeln ('<input type="image" src="cards.gif" ',
'onclick = "if (ChkOpts()) document.forms.ppform.submit (); return false;"',
'alt = "Image: Link to PayPal." />',
' &nbsp; Process credit cards by PayPal.');
  }
//-->
</script>

</form>

<script type="text/javascript">
<!--
if (root.xx_prt == on) {
  if (root.xx_prtx == off) {
    document.writeln (
'<a href="#" onclick="root.xx_prtx = on;',
'root.store();',
'document.location.reload();"> Click here to SHOW Mail Form...</a>'
    );
  } else {
    document.writeln (
'<a href="#" onclick="root.xx_prtx = off;',
'root.store();',
'document.location.reload();"> Click here to HIDE Mail Form...</a>'
    );
    document.writeln (
'<form action = "javascript: void (0);"',
'      method = "post">',
'<p>',
'<input type="image" src="print1.gif"',
'  onclick = "if (ChkOpts()) window.print(); return false;"',
'  alt     = "Image: Link to Printer." /> - ',
'Or, you can print this form and <b>mail</b> me with your remittance...',
'',
'<table cellspacing = "8"',
'       cellpadding = "8"',
'       border = "4"',
'       width="100%"',
'       frame = "box"',
'       rules = "all">',
'<tr>',
'  <td>',
'<b>Mail</b> your order here - - ',
'<br /><br />',
'',
'<b>Cheque, or Postal order</b>',
'<br /><br />',
'',
'Joe Blow <br />',
'123 Any Street <br />',
'SomeTown, World. 12345 <br />',
'(123-456-7890) <br />',
'fax (222-333-4444)',
'  </td>',
'  <td>',
'Do not forget <b>your</b> address! <br /><br />',
'<table>',
'  <tr>',
'    <td>',
'Name - ',
'    </td>',
'    <td>',
'<input type="text" size="50" />',
'    </td>',
'  </tr>',
'  <tr>',
'    <td>',
'Address 1 - ',
'    </td>',
'    <td>',
'<input type="text" size="50" />',
'    </td>',
'  </tr>',
'  <tr>',
'    <td>',
'Address 2 - ',
'    </td>',
'    <td>',
'<input type="text" size="50" />',
'    </td>',
'  </tr>',
'  <tr>',
'    <td>',
'City - ',
'    </td>',
'    <td>',
'<input type="text" size="50" />',
'    </td>',
'  </tr>',
'  <tr>',
'    <td>',
'Country - ',
'    </td>',
'    <td>',
'<input type="text" size="50" />',
'    </td>',
'  </tr>',
'  <tr>',
'    <td>',
'ZIP/Postal code - ',
'    </td>',
'    <td>',
'<input type="text" size="50" />',
'    </td>',
'  </tr>',
'  <tr>',
'    <td>',
'Email - ',
'    </td>',
'    <td>',
'<input type="text" size="50" />',
'    </td>',
'  </tr>',
'</table>',
'  </td>',
'</tr>',
'</table>',
'</p>',
'</form>');
  }
}
//-->
</script>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post"
  name="ppform"> 
<p>
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="upload" value="1" />

<script type="text/javascript">
<!--
var inp = '<input type="text" name=';
// Output any header data...
  document.writeln (inp, '"business" value="', root.xx_id, '" />');
  if (root.xx_bn.length > 0) {   // record business number
    document.writeln (inp, '"bn" value="', root.xx_bn, '" />');
  }
  if (root.xx_cbt.length > 0) {  // record continue button text
    document.writeln (inp, '"cbt" value="', root.xx_cbt, '" />');
  }
  if (root.xx_cur.length > 0) {  // record currency entry 
    document.writeln (inp, '"currency_code" value="', root.xx_cur, '" />');
  }
  if (root.xx_lc.length > 0)  {   // record user entry
    document.writeln (inp, '"lc" value="', root.xx_lc, '" />');
  }
  if (root.xx_can.length > 0)  {  // set cancel return path
    document.writeln (inp, '"cancel_return" value="', root.xx_can, '" />');
  }
  if (root.xx_ret.length > 0)  {  // set return path 
    document.writeln (inp, '"return" value="', root.xx_ret, '" />');
  }
  if (root.xx_sty.length > 0)  {  // set display style
    document.writeln (inp, '"page_style" value="', root.xx_sty, '" />');
  }
  if (root.cval.length > 0)  {    // set coupon value selected
    document.writeln (inp, '"custom" value="', root.xx_ctxt, '" />');
  }

// Now, send out the items in the cookies...
  Xbild ();

//-->
</script>
</p>
</form>

</body>

</html>

and this is the javascript

Code:
function ReadForm (obj1, tst) { //get form data for PayPal
var i,j,obj,temp,pos,val,nam3,nam4;
var qty  = 0;              // default value
var dis  = 0;              // quantity discount
  for (i=0; i<obj1.length; i++) {     // run whole form
    obj = obj1.elements[i];           // ref particular element
    if (obj.name == "tot" ||          // stkp some junk
        obj.name == "cqty" ||
        obj.name == "ctot") continue;
    nam3 = obj.name.substring (0, 3); // 3-char name (maybe)
    nam4 = obj.name.substring (3, 4); // where to store it
    if (obj.type == "select-one") {   // dropdowns
      pos = obj.selectedIndex;        // which option selected
      val = obj.options[pos].value;   // get selection
      if (val == "@-1") continue;     // skip the crap
      if (obj.name == "qty") {        // this is the quantity
        qty = val;                    // get user input
        if ((qty == "" || qty < 1 || isNaN (qty)) && tst) {  // test
          alert ("Enter a valid integer quantity!");
          return false;
        }
      } else {                        // this was not qty
        val = ChkFlg (val);           // check for flag char
        if (nam3 == "opt") {          // user says where to store
          Where (val, nam4);          // stash it
        } else {
           AddDesc (val);             // add to data
        }
      }
    } else
    if (obj.type == "select-multiple") {     // one or more
      for (j=0; j<obj.options.length; j++) { // run all options
        if (obj.options[j].selected) {
          val = obj.options[j].value;
          val = ChkFlg (val);             // flag chars?
          if (nam3 == "opt") {            // user says where to store
            Where (val, nam4);            // stash it
          } else {
            AddDesc (val);                // add to data
          }
        }
      }
    } else
    if (obj.type == "checkbox" ||    // boxes
        obj.type == "radio") {
      if (obj.checked) {             // was selected
        val = obj.value;
        val = ChkFlg (val);          // flag chars?
        if (nam3 == "opt") {         // user says where to store
          Where (val, nam4);         // stash it
        } else if (val.length > 0) {
          AddDesc (val);             // add to data
        }
      }
    } else
    if (obj.type == "text" ||
        obj.type == "textarea") {  // user input fields
      val = obj.value;             // get input
      if (obj.name == "qty") {     // this is the quantity
        qty = val;                 // get user input
        if ((qty == "" || qty < 1 || isNaN (qty)) && tst) {  // test
          alert ("Enter a valid integer quantity!");
          return false;
        }
      } else {
        if (nam3 == "opt") { // user says where to store
          Where (val, nam4); // stash it
        } else {
          AddDesc (val);     // add to data
        }
      }
    }
    if (tst == false && obj.type == "hidden" && obj.name == "initer") {
      val = obj.value;
      ChkFlg (val);
    }
  }  // end of loop

  if (qty == 0) qty = 1;     // make sure we have something
  if (qty < iqty && tst) {   // minimum items ordered?
    alert ("You must order at least " + iqty + " of this item!");
    return false;
  }
  if (qty > xqty && tst) {   // maximum items that can be ordered
    alert ("You cannot order more than " + xqty + " of this item!");
    return false;
  }
  blk2q = qty;               // record for posterity

  for (i=an-1; i>=0; i--) {  // qty amount?
    if (qty >= aqty[i]) {    // qty brkpt
      SetPrice (aamt[i]);    // force it
      AddDesc ("AMT");
      break;                 // get out, now
    }
  }

  dis = 0;                   // any qty discounts?
  for (i=dn-1; i>=0; i--) {  // run backwards
    if (qty >= dqty[i]) {    // qty brkpt
      dis = damt[i];         // set qty amount
      break;                 // get out, now
    }
  }
  if (dis > 0) {             // there is an item discount, here
    AddPrcnt (-dis);         // apply the discount
    AddDesc ("DIS=" + dis + "%");  // mark it
  }
  if (obj1.tot) obj1.tot.value = "$" + blk4a;
  if (tst) {
    StoreCart ();
    if (root.xx_dadd == off) {
      alert("Item has been aded to cart!");
      return false;            // hide cart display
    }
  }
  return true;
}