Solved

How can I get two submit button working on one page

Posted on 2010-11-15
6
460 Views
Last Modified: 2012-05-10
Dear Experts,
I am trying to send  out two different information from one page
Is it possible to get one submit button working two different thing? How?

Here is what I want to do,

1. when the "Register & Pay" button clicked I want a registration page info get saved in to my database.

2. with the same click event I want the users to be forwarded to the Paypal page so that they can have the option to pay for their registration.

How can I get this done from one "register & Pay" button.

My appreciation to you all
0
Comment
Question by:kate2001
6 Comments
 
LVL 5

Expert Comment

by:sandipshah
ID: 34141701
Create two buttons with different values - value1 and value2.

On the server side check which button was clicked by checking the variable that was set

$_POST['value1'] or $_POST['value2']

Sandip
0
 
LVL 10

Expert Comment

by:wls3
ID: 34141806
Handle the button clicked event with sequential code in a custom function.  The first portion would deal with the data being stored in the data base.  Once that transaction is complete, then, forward the response to the paypal page.
0
 
LVL 7

Expert Comment

by:Reece Dodds
ID: 34141820
You could possibly also put a different procedure call for each button in the form script and then for each button, use a 'onclick' command.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Expert Comment

by:armchang
ID: 34142047
Hi,

First of all, you can use Javascript to post two forms consectively. You can set the target of the form to something a hidden frame or iframe. Then the current document will not be lost when the first form is posted. For example, somewhere in your document you can have:

<iframe name="dummy" width="0" height="0"></iframe>

Open in new window


And then in your Javascript, you can do the following:

document.Form1.target = 'dummy';
document.Form1.submit();
document.Form2.submit();

Open in new window


I am sure that you can also use Javascript to create a hidden frame object, and then assign it to the target property so that you don't need to embed an <iframe/> in your HTML.

Does this solve your problem?
0
 
LVL 2

Accepted Solution

by:
jzkidding earned 500 total points
ID: 34143707
This can be done by calls made to different functions on the click event

Like <input type="button" value="test" onclick="a();b()"/>

in function a you can make a call to post the form using  document.myform.submit();

in function b u can redirect to other website
0
 

Author Comment

by:kate2001
ID: 34146160
Dear Jzkiding,

Can you plz show your function definition?

here is what I want.

On click:

<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
 <input type=hidden name="oid" value="00D00000000hgTo">
   <input type=hidden id="00N00000008nWch" name="00N00000008nWch" title="Registration" option value="Yes"/><br>  

On the same click I want to  pass this values and be redirect to this page:

    <input type=hidden name="retURL" value="https://www.asecurecart.net/server/cart.aspx/xxx">//landing page but I want to inclulde and pass the following values

<form id="form10" method="POST" action="http://www.asecurecart.net/server/cart.aspx/xxx">
     <input type="hidden" name="ID" value="Fee">
    <input type="hidden" name="Describe" value=" Registration Fee">
    <input type="hidden" name="Price" value="425.00">
    <input type="hidden" name="Multi" value="N">
     
And here is my button :

   <input type="submit" name="submit" value=" Register " align="center">

Thank you in advance
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Safari On Gmail only html 12 39
Set email body to html using vbscript 6 28
To remove highlight from a "a href" 5 23
Why my select dropdown does not work? 8 28
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

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

18 Experts available now in Live!

Get 1:1 Help Now