Solved

Submit one form one button to two different action file ?

Posted on 2008-06-09
4
1,905 Views
Last Modified: 2013-11-19
I have a sample form per say myform, when I slick submit button I want the file be process by two different action files (insertrecord.php, insertrecord2.php). Here is the sample code :
Is it possible to create two actions for only one form using javascript or php or any html trick ?

/** sample code */
<form action="process1.php" action="process2.php"  name="myform"> # !!!! pay attention here

   <input type="text" name="First_Name">
   <input type="text" name="Last_Name">
   <input type="submit" value="Submit Form" name="submit">

</form>

It is kinda long story why do I need it, but I really needed.
Thank you
0
Comment
Question by:hpolat
  • 2
  • 2
4 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
ID: 21748674
<form  name="myform" method="post" target=_blank>

   <input type="text" name="First_Name">
   <input type="text" name="Last_Name">
   <input type="button" value="Submit Form" name="submit1" onclick="submitform()">

</form>
Jaascript function

function submitform()
{
document.myform.action = "1.asp";
document.myform.submit();
document.myform.action = "2.asp";
document.myform.submit();
}
0
 

Author Comment

by:hpolat
ID: 21749333
when I try your form it works, after I adjust my code it doesn't. if I use button it doesn't do anything, but if I do submit then it only pops the first ation but second action doesn't start :(
HERE IS MY CODE, ANY THOUGHTS ?

basically I have
<FORM id="formvip" method="POST" E="formvip" onSubmit="return vipvalidate()" target=_blank name="formvip" >
            <!-- DO NOT MODIFY: the hidden input field with id "webformid" -->
            <input type="hidden" name="webformid" id="webformid" value="b15c6d29-d71b-4e47-ac86-b8a256ff5c74" />
                  <INPUT id="vipparty" TYPE="hidden" NAME="vipparty" value=""><br>
....
....
....
.....
                  <input type="submit" name="submit" value="<-- S U B M I T -->" STYLE="background:990000; color:#999999" onClick="submitform()">
                  </FORM>
           
<SCRIPT language = "javaScript">
            function submitform()
            {
            document.formvip.action = "las_vegas_bachelor_bachelorette_party_processformvip1.php";
            document.formvip.submit();
            document.formvip.action = "las_vegas_bachelor_bachelorette_party_processformvip2.php";
            document.formvip.submit();
         
            }
 </SCRIPT>  
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 21749360
type of button in button not submit

 type="button"

<input type="button" name="submit" value="<-- S U B M I T -->" STYLE="background:990000; color:#999999" onClick="submitform()">
0
 

Author Comment

by:hpolat
ID: 21752083
I did that, and now when I click the submit button, nothing happens and the bottom right corner of the internet explorer displays a message : "Eror on page;"
any idea ?
thank you
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now