This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Two submit buttons sending to different redirect urls


  1. brianmcgrath
    Member

    Hi,

    I currently have a form which on submission redirects to a paypal payment page. However I need to add another submit button
    (ie. "Pay by cheque") which will submit the same form but will instead redirect to a different url / thank you page.

    Any help on this hugely appreciated!

    Brian

    Posted 13 years ago #
  2. redityo

    Hi,

    It's not possible to put two submit button in the form. However, there is another way for this with small customization.
    First, you need to put a drop down field into the form with options "pay by paypal" and "pay by cheque". Then you can follow the method that posted in here for the customization.

    http://www.appnitro.com/forums/topic/dropdown-links?replies=4#post-2776

    That would redirect to different url based on your "drop down" field selection.


    MachForm Support

    Posted 13 years ago #
  3. DaveVoss
    Member

    I tried your suggestion, but it didn't work. So to make a really simple test, I just added two lines of code so that the "if" statement looks like this:

    if(!empty($form_review)){
    $process_result['review_id'] = $record_insert_id;
    $redirect = 'http://www.google.com'; //Voss added
    $process_result['form_redirect'] = $redirect; //Voss added
    }

    When I fill out form #2 I still get the "success" message. It doesn't redirect to google.com. What am I doing wrong?

    Posted 13 years ago #
  4. yuniar

    The code above only work if you have "form review" enabled. Have you turned it on?


    MachForm Founder

    Posted 13 years ago #
  5. DaveVoss
    Member

    I've tried it both ways, with review turned on and review turned off. In both cases I just get the "success" message. The instructsions in the post
    http://www.appnitro.com/forums/topic/dropdown-links?replies=4#post-2776
    say that it should work with review turned off, but the "if" statement translates to me as "if form review is not empty, which means it's turned on" etc.

    The lines I inserted start at line 1222 in version 2.4

    Posted 13 years ago #
  6. DaveVoss
    Member

    Ok I got it to work with out review turned on, which is how I want it anyway. I added the two lines ABOVE the code like this:

    if(empty($error_elements) && empty($process_result['custom_error'])){
    $process_result['status'] = true;
    //Line 1218 of post-functions
    $redirect = 'http://www.yahoo.com'; //voss added
    $process_result['form_redirect'] = $redirect; //voss added

    //if 'form review' enabled, send review_id
    if(!empty($form_review)){
    $process_result['review_id'] = $record_insert_id;

    Posted 13 years ago #

RSS feed for this topic

Reply