Powered by:
FutureQuest Hosting


"...Remember being a youngster, mom or dad telling you "close the door"? Well the same applies to HTML ...."

Web Hosting
Shared       
Reseller     
VPS             
Dedicated 
Price:   $(US)
Space:     (MB)
Transfer:(GB)
Platform:


Advertise
Advertising Opportunities
Rate Card

Sponsor
Go Back   Webmaster Forums > Code Forum > Javascript Forum


Reply
 
Thread Tools Rate this Webmaster Discussion
  #1  
Old 11-01-2009, 09:45 AM
Website Reaction Website Reaction is offline
Junior Member
 
Join Date: Nov 2009
Location: Preston, Lancashire
Webmaster Discussions: 2
Rep Power: 1
Website Reaction is on a distinguished road
Passing results of script in one form to another.

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>


Reply With Quote
Reply
Sponsor

Bookmarks

Tags
form , script

Thread Tools
Rate This Thread
Rate This Thread:

 

Similar Webmaster Discussions
Thread Webmaster Discussion Starter Forum Replies Last Post
Passing username through a form Lorib01 PHP Forum 0 04-25-2008 12:03 PM
Passing username through a form Lorib01 Javascript Forum 3 04-22-2008 01:33 AM
Passing a Javascript Variable Value through a form tjanson Javascript Forum 2 01-11-2008 07:20 PM
Form Results Processing Ted B Website Scripts Forum 2 11-08-2007 02:30 PM
How to use Form Results within same page murphy903 HTML Forum 4 08-23-2007 04:22 PM


All times are GMT -5. The time now is 10:27 PM.

Copyright © 1999 - 2009 Advanced HTML For Beginners and AHFB2000. All rights reserved.
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.