473,467 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

one form and one button with multiple action

4 New Member
Hi!
I have this code that only submit to checklogin.php
I've tried interchanging the destinations for the submit and i always end up having the data only at the last argument.
Please help me.

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. function submitme()
  3. {
  4. document.Form1.action = "init_profile.php"; //first destination
  5. document.Form1.submit(); 
  6.  
  7. document.Form1.action = "getmempicture.php" //second destination
  8. document.Form1.submit();    
  9.  
  10. document.Form1.action = "init_profile.php" //third destination
  11. document.Form1.submit();        
  12.  
  13. document.Form1.action =  "checklogin.php"; //forth destination
  14. document.Form1.submit();    
  15.  
  16. return true;
  17.  
  18. }
  19. </script>
  20.  
  21. <form name="Form1" method="post" action="checklogin.php" onSubmit="return submitme()">
  22. <b>Log In Account</b><br /><br />
  23. Username: <input  type="text" id="myusername" /><br />
  24. Password: <input type="password"  id="mypassword" /><br /><br />
  25. <input type=reset value="Clear" />
  26. <input type="submit" name="Button1" value="Login" />
  27. </form>
Feb 6 '09 #1
6 6806
acoder
16,027 Recognized Expert Moderator MVP
You can't reuse the same form for multiple submits like this. Either use Ajax or multiple forms.
Feb 7 '09 #2
c h e r r y
4 New Member
i've tried placing a target for each of the destination and it worked. now my problem is that it opens 4 different browser windows. i only need one window having the all the contents from the 4 url's

Expand|Select|Wrap|Line Numbers
  1. document.Form1.action = "init_profile.php"; //first destination 
  2. document.Form1.target = "init_profile.php";
  3. document.Form1.submit();  
  4.  
  5. document.Form1.action = "getmempicture.php" //second destination 
  6. document.Form1.target = "getmempicture.php";
  7. document.Form1.submit();     
  8.  
  9. document.Form1.action = "showimage.php" //third destination
  10. document.Form1.target = "showimage.php";
  11. document.Form1.submit();         
  12.  
  13. document.Form1.action =  "checklogin.php"; //forth destination
  14. document.Form1.target = "checklogin.php";
  15. document.Form1.submit();
Feb 9 '09 #3
acoder
16,027 Recognized Expert Moderator MVP
Setting the target sets the target to the name of the window. Since the window doesn't exist, it opens a new one.

You can solve this by using a combination of JavaScript and server-side code or using iframes/frames. The easiest way to solve this would be to submit to one page which takes the form data and runs it through the 4 pages and returns the collated result.
Feb 9 '09 #4
c h e r r y
4 New Member
ok! thanx for that. i'll try it.
Feb 9 '09 #5
dkhanna01
2 New Member
Im not sure if I understood correctly. what I am doing right now is:

<form enctype='multipart/form-data' method='post' action=''process.php" target="_blank">
Now by doing this it execute process.php in new window which exactly what I wanted but now in addition to this I just want to reload this same page.
Oct 15 '09 #6
acoder
16,027 Recognized Expert Moderator MVP
You could reload from the opened page, via window.opener.location.reload()
Oct 24 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Marc | last post by:
Hello, I have a self - submitting form with multiple submits and I want to detect after the submit which button is pressed. Code example: <form name="example" method="post"...
19
by: Pete | last post by:
I have form/select which executes a function using onchange. No problem. However, when I validate the page with a strict HTML 4.01 doctype at http://validator.w3.org, it demands either an action or...
2
by: Laurent Bertin | last post by:
Hi i got a strange problem but it's true i don't make thing like anyone... First Config: + IIS5.0 SP2 (yes i know...) WebSite Security Root : Digest Authentication, NT Authenticated SubFolders...
15
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and...
2
by: Matt | last post by:
The ASP page has multiple buttons, and when the user clicks different buttons, it will submit the form data to different URLs. My first approach was to use BUTTON type, and triggers javascript...
16
by: NathyZif | last post by:
I know I know, why would I want to submit the form from server-side code, if the only way to get to the server-side code was BY submitting the form. But that's just it, when the code-behind...
4
by: kschneider | last post by:
Assume there's a form with it's action attribute all set to post to a URL, but without a submit control. Form submission is done via a link and I want to prevent the classic "double submit"....
4
by: wim taerwe | last post by:
Hello, I am looking for an easy way to have a delete button per subitem in 1 form. For example : a book can have many authors and when I edit the book details I want to have a list of the...
4
by: wwwmike | last post by:
How can I overwrite the <FORM action=attribute? I can add new attributes with Dim xx As System.Web.UI.HtmlControls.HtmlForm xx = Page.FindControl("form1") xx.Attributes.Add("something",...
9
by: mosscliffe | last post by:
I am struggling to find a python example of the scenario - I have. I have a python script, which generates a page with a search button (actually an input field). The data from the above...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.