1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Form with multiple action urls

Discussion in 'HTML & JavaScript' started by ramenraider, May 11, 2010.

  1. ramenraider

    ramenraider Newbie

    Joined:
    Aug 15, 2009
    Messages:
    48
    Likes Received:
    10
    Basically, I want users to fill out a form, lets just say zip and email. I want the form to submit to my database (already have this) but also an affiliate zip submit. I need this to happen on one click to the submit button.

    I have good knowledge of php and html, and little knowledge with js, can anyone point me in the right direction? and is this even possible ><
     
  2. ramenraider

    ramenraider Newbie

    Joined:
    Aug 15, 2009
    Messages:
    48
    Likes Received:
    10
    anybody know?
     
  3. datacyborg

    datacyborg BANNED BANNED

    Joined:
    Jul 11, 2009
    Messages:
    52
    Likes Received:
    4
    you have to pass the data through post method or get method.When you are clicking the submit button you can use post or get method as form action.I think you can easily handle that.
     
  4. kuzmanin

    kuzmanin Regular Member

    Joined:
    Jul 17, 2010
    Messages:
    386
    Likes Received:
    45
    the only way to submit to more than one locations is to open a new window.
    you have to add onsubmit event on <form ...> and call a JS function then read all variables from form with getElementbyname('input name').item(0).value and construct new URL with "hxxp://...../scriptname.php?param1="+parama_value+'&param2......' then window.open(URL, options) and return true; to submit original form
     
  5. emicsoft211

    emicsoft211 Registered Member

    Joined:
    Apr 16, 2010
    Messages:
    87
    Likes Received:
    1
    Occupation:
    webdeveloper and designer
    there is custom script for finding ip.You can integrate those in your site.
     
  6. kaidoristm

    kaidoristm Power Member

    Joined:
    Feb 13, 2009
    Messages:
    561
    Likes Received:
    726
    Occupation:
    Freelancer
    Location:
    Estonia
    Home Page:
    Wrong thread sorry!
     
    Last edited: Jul 25, 2010
  7. emicsoft211

    emicsoft211 Registered Member

    Joined:
    Apr 16, 2010
    Messages:
    87
    Likes Received:
    1
    Occupation:
    webdeveloper and designer
    it's okay
     
  8. voyevoda

    voyevoda Regular Member Premium Member

    Joined:
    Mar 21, 2010
    Messages:
    217
    Likes Received:
    97
    Location:
    Eastern Front
    Have the action of the form be the normal affiliate URL.

    Add an onSubmit handler to the form that fires off a synchronous AJAX request to your server (which records the data) before allowing normal execution to continue. This basically shims in an external request before the normal form processing would happen.
     
  9. mward

    mward Newbie

    Joined:
    Oct 19, 2010
    Messages:
    43
    Likes Received:
    3
    Occupation:
    manager
    Location:
    uk
    easiest way is to on the button, have a onclick="document.form.action='';". You will need to use a standard button not a submit button then you can fire the sumit
    document.form.submit();
     
  10. Webjog

    Webjog BANNED BANNED

    Joined:
    Oct 21, 2010
    Messages:
    22
    Likes Received:
    0
    I recommend it