Have you ever wanted to make a simple form do multiple actions and you didn't know how. The answer was hidden from me for some time, but I managed to imagine how to do this when I read an article by Chris Maunder "Specifying multiple actions from a single Form".
In that article Chris manages to send information of the form to different pages, but there he needs different buttons for each action. So, I decided to edit a little bit of his code, to get multiple actions done by pressing the Submit button once. Now, I will explain you how to do this.
First let's have a simple form like this:
<form name=Form1 action= "login1.php" method=post>
Username <input type="text" name="username">
Password <input type="password" name="password">
<input type="submit" value="Send" name="button1"
document.Form1.action = "login2.php" document.Form1.target = "iframe1"; document.Form1.submit(); document.Form1.action = "page3.php" document.Form1.target = "iframe2"; document.Form1.submit(); return true;
OK, now we are submitting the data to two pages. As you can see they have got a target like a frame. This is because we need it to open the two new pages with the data, but for not bothering the user we hide the IFRAMEs like this:
<iframe NAME="iframe1" WIDTH="40" HEIGHT="40"></iframe>
<iframe NAME="iframe2" WIDTH="40" HEIGHT="40"></iframe>
The page will send the data to IFRAME and the information will be processed as you wanted.
Note: The user will only see login1.php confirmation and not the second login confirmation. Maybe you could create a page for the user to know if he could login in both pages or like me create a page that redirects to the index.