Forum Moderators: open

Message Too Old, No Replies

Help! form with one button and dual action

         

iamjoe

4:05 pm on May 20, 2004 (gmt 0)

10+ Year Member



I'm hurtin

I have a similar issue from here
[webmasterworld.com...]

I need to POST data to two forms from one button.

Many Thanks

Bernard Marx

7:11 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



[quote]I'm not a javascript guru[/code]
Neither am I, especially when it comes to anything related to forms and PHP, but I have a feeling that you can't post 2 forms on the same page simultaneously. Using Iframes perhaps?

jatar_k

7:14 pm on May 20, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld iamjoe,

I need to POST data to two forms from one button.

do you need a return from both? You could have a script php/perl/asp that will handle the two submits one after the other and then return some kind of confirmation when it is done.

I don't see a quick and dirty way though, it takes some programming and you would need a server side solution, not js.

iamjoe

9:06 pm on May 20, 2004 (gmt 0)

10+ Year Member



I need to post the data to two different servers. One is going to return a few form variables from an .asp page via <%=request.form("field")%>

and the other page is simply going to grab the form fields and then perform a 'behind the scenes' ftp transfer.

I'm fooling around with posting the same form to different frames, but I am still stumbling.

Any help is appreciated.

Joe

jatar_k

9:27 pm on May 20, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well, to be honest, in php I would use curl [curl.haxx.se] but I am not sure if that is an option for you.

Rambo Tribble

2:45 am on May 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would think that if you have two forms, you could use JavaScript to make the field values equal, then use the form.submit() function to submit each seqentially. The first action would be accomplished something like:

document.form2_name.field1_name.value=document.form1_name.field1_name.value;

The second would look something like:

form1_name.submit();
form2_name.submit();

The method and action values specified for each form would, of course, determine how they were handled.

grandpa

6:21 am on May 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



How about...
The form action does its thing, as expected.

<form action="http://www.example.com/NEXT.php" method="POST">
<input type="hidden" name="name1" value="value1">
<input type="hidden" name="name2" value="value2">
<input type="submit" value="Submit">
</form>

Then, in NEXT.php you would do whatever business you had there, and submit the LAST program, which could have a line like this in the header:

<meta http-equiv="refresh" content="0;url=http://www.example.com/RETURN_TO_ORIGINAL_PAGE.html">";

Seems like it might work....