View Full Version : sending data to 2 forms
ignoranceisblis
02-18-2005, 04:05 AM
can anyone give me a brief example of how to send form data to 2 different scripts at the same time?
T.I.A.
mlseim
02-18-2005, 04:29 AM
wow ... that's an interesting question ...
I know that the form itself can only post to ONE action.
But, the variables could be bounced from one script to another ...
I would say at least one of the scripts cannot have the final
process display to the browser. If both scripts create browser
outputs, I don't think it can be done.
-----------------
Maybe have the form POST to the script that does not output
to the browser, and at the end of that script, it does a
Print Location to the other script, sending the variables.
EDIT: I just tried this method and it worked good. I sent form
data to a script that stored the variables in a database, and
then it sent the data to another script using:
print "Location: two_script_test.pl?var1=test1&var2=test2\n\n";
The second script actually sent an email and then returned
to a webpage with IT'S own print "Location....";
I'm sure I could have send the data to another script on
anyone else's website.
-------------------
Another option .... have the form POST to a third script that only
writes the variables into a temporary file. The other two scripts
read the data when they are triggered by some other event.
-------------------
Or .... maybe something Javascript related.
I'm kinda stumped on a java example ... :o
EDIT AGAIN:
I really think it could be done with Javascript on the same
page as the HTML form. The whole key here is that neither
of the two Perl scripts can have an output to a browser.
A Perl outputting to the browser would ruin the integrity of
the page that was displaying the form. A Javascript expert
could write a script to capture the submit button and send
to a Perl script, then send to another Perl script.
I don't know Javascript good enough to give an example.
.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.