![]() |
| HTML | PHP Scripts | Webmaster Tools | Webmaster Forums | Web Hosting | Domain Names | Webmaster Books |
|
|
#1 |
|
New Member
Join Date: Nov 2009
Location: Preston, Lancashire
Webmaster Discussions: 2
Rep Power: 6 ![]() |
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>£12.00</b> We will contact you to confirm this."); } else {document.write("The cost of your consignment is <b>£"+_end1+"</b> Sameday or Overnight service, or" + "<br />"); } if (miles < 10) {document.write("" ); } else {document.write("<b>£"+_start+"</b> Non priority service, saving you <b>£"+_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 & 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 & collection.<br /> <br /> <input name="Submit" type="Submit" value="Confirm booking" /> </p></td> </tr> </table> </form> </div></div> </body> </html> |
|
|
|
![]() |
| Bookmarks |
| Tags |
| form, script |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Webmaster Discussions
|
||||
| Thread | Webmaster Discussion Starter | Forum | Replies | Last Post |
| How to use Form Results within same page | murphy903 | HTML Forum | 5 | 02-17-2010 03:45 PM |
| Passing username through a form | Lorib01 | PHP Forum | 0 | 04-25-2008 11:03 AM |
| Passing username through a form | Lorib01 | Javascript Forum | 3 | 04-22-2008 12: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 |