Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    can a form have 2 actions

    in other words how do i create my form on my sign up page to write to my join php file and go to my payment page when the submit button is click

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well what you could do is have your form target="_blank", so it'll submit to a pop-up window, or include a hidden iFrame on your page and submit to it (also using the target attribute). Instead of having a submit input, just have a button that calls submit and redirects the page.

    Code:
    <script>
     function submitRedirect() {
      var frm = document.getElementById('myForm');
      frm.action = 'join.php';
      frm.target = '_blank';
      frm.submit();
    
      location.replace('payment.php');
     }
    </script>
    </script>
    <form id="myForm" method="post"...>
     <input ...>
     ...
    
     <button onclick="submitRedirect()">submit</button>
    </form>
    I think that should work. If you have a questions or problems, just post back.

    Sadiq.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Crossposted

    Please read the rules again, it's all part of being a member in good standing of this community.

    can a html form have 2 action ??
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Heh, I didn't even think of the PHP solution.. nice one though, much cleaner!

    Sadiq.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •