Solved

Submit one form one button to two different action file ?

Posted on 2008-06-09
4
1,908 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error Handler 8 45
Google Chrome: Debugging AJAX call 6 39
sitemap.xml 3 32
Position image fpdf 4 19
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

752 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