Solved

Submit one form one button to two different action file ?

Posted on 2008-06-09
4
1,903 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
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…

707 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

12 Experts available now in Live!

Get 1:1 Help Now