Forum Moderators: open

Message Too Old, No Replies

Passing Form Variables to 2 Websites with 1 Click

Forms processing

         

dpower

5:46 pm on Mar 30, 2003 (gmt 0)

10+ Year Member



Hello,
I'm new here but have been working with HTML for about five years. My question is about passing FORMS variables to two different OUTSIDE URLS with one SUBMIT button.

Here's what I mean. Let's say I have FORMS variables set up like this:

<input type=TEXT NAME=first_name><br>
<input type=TEXT NAME=last_name><br>

With one click (one submit) I want to pass these variable names to offsite URLS that are set up to accept and process these variable names.

For example - (these don't work but are provided for example only) I may have a FORM tag like this

<FORM ACTION="https://some_outside_url_1.com" METHOD=POST>

and I might have another FORM tag like this

<FORM ACTION="https://some_outside_url_2.com" METHOD=POST>

As you can see I'd be passing the data in SECURE mode.

Is there any way to make both actions occur with ONE SUBMIT button? If not, how can I make it easy on my visitors so they don't have to click two different SUBMIT buttons on two different pages to get the job done for me?

Thank you for any help you can give.

David

craig1972

6:25 pm on Mar 30, 2003 (gmt 0)

10+ Year Member



what technology are you using in the backend? you can simulate secure form posts through header functions (raw https). it is a breeze with php and jsp. through your code, you send off the form to the external websites and get the response, and accordingly show results to a user.

alternatively, you could open two windows or something, but that is a little painful instead of being painless.

ShawnR

2:32 am on Mar 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One way is to have the second form with hidden fields...

e.g.
<FORM name="myForm2Name" ACTION="https://some_outside_url_2.com" METHOD=POST>
<input type=hidden NAME=first_name>
</form>

Then the form button:
<a href="javascript:submitMyForms()">

where


function submitMyForms() {
document.myForm1Name.submit();

then some code to copy the entries
in form 1 to the hidden entries
in form 2...

document.myForm2Name.submit();
}

I think that will work, although there may be a more elegant way, especially if you can do it from the server side as Craig suggests.

Shawn

Purple Martin

6:55 am on Mar 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure ShawnR's suggestion would work: as soon as one submit method happens, won't the browser redirect before the second submit gets processed?

jamesa

8:10 am on Mar 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you could submit two forms at the same time, how would you handle the multiple responses? The only way would be as craig1972 suggests:
1)submit to your own script,
2) have your script make it's own HTTP POSTS to the two other sites,
3) your script receives the responses, reformats them and returns the results back to the browser.

jamesa

8:13 am on Mar 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually ShawnR's suggestion might work if you spawn two different windows or frames...

dpower

2:37 pm on Mar 31, 2003 (gmt 0)

10+ Year Member



Thank you everyone - I'll have to skin this cat another way.

David