Hi All,

I am trying to find out how to pass the results of a script in one form to an input box(s) in second form. I don't even know if this can be done? I have attached the code below - The first form (zip_lookup)gets postcode data and calculates the distance between them and writes the result with a little bit of math. The second form posts data to formmail.cgi. What I want to do is when the user enters the postcodes and clicks 'calculate costs' for the document to write as normal and enter the data into the three input boxes of the second form (contact).

Hope someone can help.

Regards,
Colin Smith.

The code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<div id="container">
<div id="content">
<script language="javascript" type="text/javascript" src="http://www.pc-i.co.uk/postcode_js.php">
</script>
<form name="zip_lookup" id="zip_lookup" method="get">
<p class="small">
</p>
<table width="100%" border="0" cellpadding="0" cellspacing="10">
<tr>
<td valign="top" class="small">Collection Postcode:</td>
<td valign="top" class="small"><input type="text" name="post_a" id="post_a" /></td>
</tr>
<tr>
<td valign="top" class="small">Delivery Postcode:</td>
<td valign="top" class="small"><input type="text" name="post_b" id="post_b" /></td>
</tr>
<tr>
<td valign="top" class="small"><input name="submit" type="submit" value="Calculate cost" /></td>
<td valign="top" class="small">
<script language="javascript" type="text/javascript">
var _start= Math.round (miles*100)/100;
var _end1= Math.round (_start*120)/100;
var _saving= Math.round ((_end1-_start)*100)/100;
if(postcode_a != "")
if (miles < 10) {document.write("The cost of your consignment is <b>&pound;12.00</b> We will contact you to confirm this."); }
else
{document.write("The cost of your consignment is <b>&pound;"+_end1+"</b> Sameday or Overnight service, or" + "<br />"); }
if (miles < 10) {document.write("" ); }
else
{document.write("<b>&pound;"+_start+"</b> Non priority service, saving you <b>&pound;"+_saving+"</b>. We will contact you to confirm this."); }
</script></td>
</tr>
</table>
</form>
<form action="/formmail/FormMail.cgi" method="post" name="contact" class="" id="contact">
<table width="100%" border="0" cellpadding="0" cellspacing="10">
<tr>
<td valign="top" class="small">
<p>

<input name="Delivery service" type="radio" value="Same Day" />
1,
<input name="Same Day cost" type="text" id="Same Day cost" size="10" />
Same Day delivery anywhere in the UK. <br />
<br />
<input name="Delivery service" type="radio" value="Overnight" />
2,
<input name="Overnight cost" type="text" id="Overnight cost"size="10" />
Overnight delivery &amp; collection.<br />
<br />
<input name="Delivery service" type="radio" value="Non priority" />
3,
<input name="Non priority cost" type="text" id="Non priority cost"size="10" />
Non Priority delivery &amp; collection.<br />
<br />
<input name="Submit" type="Submit" value="Confirm booking" />
</p></td>
</tr>
</table>
</form>
</div></div>
</body>
</html>