473,396 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Passing a form twice

52
So I'm woking on a page with a form and I've run into a problem. I need my form to be submitted to two places. First it needs to be passed to my ASP code which will send an email using data on the form. After the email is send it needs to be submitted to another website. This other website is basically looking for specific information to be submitted and it will take it into a database. I have no control over this database or the site.

is there anyway that I can do this in asp? basically take in the form and resubmit it after it's done with it's work?

I appreciate any help I can get!
Apr 4 '08 #1
4 1350
DrBunchman
979 Expert 512MB
Hi Shisou,

You sure can if you use a bit of javascript. Place this line in your html and it will automatically submit your form when it is reached:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">document.form1.submit();</script> 
All you need to do is change form1 to the name of the form you're submitting.

I would store all the data submitted from the first page as hidden fields on the second page (which sends the e-mail) and then submit that form using the javascript to the third, external, page.

Page 1.asp
Expand|Select|Wrap|Line Numbers
  1.  <form name="form1" action="Page2.asp"> 
  2. <input type="text" name="Input1" />
  3. <input type="submit" value="Submit" />
  4. </form>
  5.  
Page2.asp
Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim sInput
  3. sInput = Request("Input1")
  4.  
  5. ....e-mail code goes here...
  6. %>
  7. <form name="form2" action="ExternalWebsite.asp">
  8. <input type="hidden" name="Input1" value="<%=sInput%>" />
  9. </form>
  10. <script type="text/javascript">document.form2.submit();</script>
  11.  
Does this make sense? Let me know if it helps,

Dr B
Apr 4 '08 #2
Shisou
52
I think i get what you're saying... so I submit the form first to my asp page to have the email sent, then in the html portion of the second page i rebuild the form (kinda) and use JS to submit it again to the third (external) site.... should i put the JS anywhere inparticular on the second page (head, body, ect..) since I think it will behave differently depending?
Apr 4 '08 #3
Shisou
52
YAY!

This worked like a charm, I haven't tested it going to the third site yet because it needs to be in production to do that, but the email sends perfectly and through some testing i see the form values pass without issue.

Thank you again! I don't know what I would do without this site :D
Apr 4 '08 #4
DrBunchman
979 Expert 512MB
YAY!

This worked like a charm, I haven't tested it going to the third site yet because it needs to be in production to do that, but the email sends perfectly and through some testing i see the form values pass without issue.

Thank you again! I don't know what I would do without this site :D
No problem, I'm glad I could be of help :-)

Dr B
Apr 7 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Dave Smithz | last post by:
Hi there, I have a situation where I want to have multiple submit buttons on the same form and therefore want to use a redirection php script that checks the value associated with the submit...
4
by: bateman | last post by:
Hi, I have a rather puzzling problem, have asked the ASP experts at work with no joy and its driving me mad! I'll explain the steps in more detail below but the general problem is I am manually...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
25
by: Victor Bazarov | last post by:
In the project I'm maintaining I've seen two distinct techniques used for returning an object from a function. One is AType function(AType const& arg) { AType retval(arg); // or default...
10
by: Steve | last post by:
Can anyone recommend the best way to pass a string back to the calling class (windows form) from a dialog that was shown modally using ShowDialog?
8
by: Dennis Myrén | last post by:
I have these tiny classes, implementing an interface through which their method Render ( CosWriter writer ) ; is called. Given a specific context, there are potentially a lot of such objects,...
10
by: Sebastian Santacroce | last post by:
Hi, If I want to pass a form (forms I have created) to a function what would I set the declaration as for example Dim p as existingForm OpenForm (p, existingForm)
8
by: Garry Jones | last post by:
I allows users to enter data in a form. I process the form with a php file. I return control to another page on my website. I want to dynamical create the page that they are returned to so I can...
1
by: TheSailor | last post by:
Forgive me - I am a bit new to cURL and passing form elements from one site to the next... If you can help with a HOW TO or by holding my hand a bit with examples - so I can learn - I would be in...
7
by: Jason | last post by:
Hello I've got a very simple C# app, that has a datagrid, a text box, and a button which when clicked opens a second form... Form2 frm2 = new Form2(); frm2.Show(); When I place a datagrid,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.