First add on your page two "hidden" iframes where you may submit. [code=php] <div style="visibility:hidden"> <iframe name="ifr1" width="20" height="20"></iframe> <iframe name="ifr2" width="20" height="20"></iframe> </div> [/code] Now you can build a function [code=php] <script type="text/javascript"> function submitTwice(f){ f.action = 'first.php'; f.target='ifr1'; f.submit(); f.action = 'second.php'; f.target='ifr2'; f.submit(); } </script> [/code] and the form: [code=php] <form method="post"> .... <input type="button" value="Send" onclick="submitTwice(this.form)"> </form> [/code]
@wpdfranMay 11.2007 — #This is an AWESOME script. I know nothing about Javascript and was still able to use it. I have a question though. Is it possible to add a verification script to this? The script I need to use requires the form to have a name and I can't seem to figure out where to put it. Any ideas?
@kthurstoJul 07.2008 — #Has anyone encountered any problems w/ this scipt working in Firefox? It works wonderfully for me in IE; but, does not submit any data via FF.
As my thankyou page was itself integrated in my action script when i submitted i got two thank you pages in new window which i dont want, infact i want the thankyou page to be opened in the same window, so i simply deleted f.target from the javascript, so now
Instead of this:
<script type="text/javascript">
function submitTwice(f){
f.action = 'first.php';
f.target='ifr1';
f.submit();
f.action = 'second.php';
f.target='ifr2';
f.submit();
}
</script>
i kept in the header of the contact for this:
<script type="text/javascript">
function submitTwice(f){
f.action = 'first.php';
f.submit();
f.action = 'second.php';
f.submit();
}
</script>
Thats it, But thanks Kor after all i got what i needed becaz of you.
link 1 works when [I]"f.target='ifr*';"[/I] is included and link 2 works when it is deleted. They don't both work together.
anyone?[/QUOTE]Some browsers may have a problem with queueing the data from two forms, so it's not entirely surprising that it failed and I don't think it could be considered reliable. If a JavaScript-dependent solution is acceptable, an AJAX routine would be far more dependable, but the best solution has to be a server-side forwarding script.