The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/showthread.php 26 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 909 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/showthread.php 26 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/showthread.php 26 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/showthread.php 137 forum_permissions
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key "mybb" - Line: 1952 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1952 errorHandler->error
/inc/functions_indicators.php 41 my_set_array_cookie
/showthread.php 629 mark_thread_read
Warning [2] Undefined property: MyLanguage::$ratings_update_error - Line: 5 - File: showthread.php(732) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/showthread.php(732) : eval()'d code 5 errorHandler->error
/showthread.php 732 eval
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "invisible" - Line: 1506 - File: showthread.php PHP 8.1.27 (Linux)
File Line Function
/showthread.php 1506 errorHandler->error
Warning [2] Undefined variable $threadnotesbox - Line: 30 - File: showthread.php(1533) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 30 errorHandler->error
/showthread.php 1533 eval
Warning [2] Undefined variable $addremovesubscription - Line: 79 - File: showthread.php(1533) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 79 errorHandler->error
/showthread.php 1533 eval



FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Two forms on the same page
#1
I've got two forms on the same page that go to different submissions pages (this is for a Paypal IPN payment type). These are both single form submissions..and everything seems to be fine except that one of the forms won't save to the database. I'm not exactly sure why...but I have a feeling it is due to the fact that I'm doing this on the page:
Code:
$fields = ft_api_init_form_page(8, $pp["mode"]);
$fields = ft_api_init_form_page(9, $pp["mode"]);

...now I know what you're thinking: Don't do that then! The problem is I don't know what else to do to declare these fields variables. The user could essential fill out either of the forms...not sure which one..so I need to do the $fields for both of them. Is there a way to do this? Or is the way I'm doing this fine and it's some completely different problem?

Thanks for your help :-)
Since the forms that appear on this page are both single page forms, I've chosen to do the following:
Code:
if (isset($_POST['form_9_submit'])) {
    $fields = ft_api_init_form_page(9, $pp["mode"]);
    $pp["form_id"] = 9;

    if ($pp["mode"] == "initialize") {
        $params = array(
            "submit_button" => "send",
            "next_page" => "/form-9-success",
            "form_data" => stripslashes_deep($_POST),
            "finalize" => true
        );
    } else {
        $params = array(
            "submit_button" => "send",
            "next_page" => "/form-9-submit",
            "form_data" => stripslashes_deep($_POST),
        );
    }
    ft_api_process_form($params);
} else if (isset($_POST['form_8_submit'])) {
    $fields = ft_api_init_form_page(8, $pp["mode"]);
    $pp["form_id"] = 8;

    if ($pp["mode"] == "initialize") {
        $params = array(
            "submit_button" => "approve",
            "next_page" => "/form-8-success",
            "form_data" => stripslashes_deep($_POST),
            "finalize" => true
        );
    } else {
        $params = array(
            "submit_button" => "approve",
            "next_page" => "/form-8-submit",
            "form_data" => stripslashes_deep($_POST),
        );
    }
    ft_api_process_form($params);
}

What I've done is to place the $fields variable inside of the if-else conditional based upon which submit button is clicked. I don't really need to worry about the fields getting filled in if the user navigates back to this page before submitting...since it will rarely happen, and there isn't a lot of stuff to fill out.

What I want to know is if this will hurt anything down the road...besides hindering the ability to fill in the fields from sessions. I don't see any other problems with this myself...but I'd like some other opinions/thoughts.

Thanks!
Reply
#2
Interesting approach. I might be totally muddled on this, but does the session created by FT need to happen before the form is submitted? ie if the ft_api_init is only called after the form submit button, won't that confuse things?
Reply
#3
My approach above definitely works for single page forms...on more than one page it may not (it's untested on that). I don't think it will work if the user navigates away and back to the page to refill the fields since the $fields variable is set only upon a click of the submit button in either case.
Reply
#4
Hey guys,

Yeah, neat idea - but as it stands it definitely won't work. The second ft_api_init_form_page() function will overwrite the session information for the first.

However, I DID plan for this when I first wrote the API... but I confess I haven't tested this in a looong time... so fingers crossed I haven't done anything dumb to mess it up in the meantime.

There's a hidden third parameter you can pass to the ft_api_init_form_page() function: the namespace. To explain: by default all form data that's stored in sessions while the user progresses through the form is found at this location:

PHP Code:
$_SESSION["form_tools_form"

The "form_tools_form" is the default namespace. That contains things like the form ID, submission ID etc:
PHP Code:
$_SESSION["form_tools_form"]["form_tools_form_id"]; // e.g. 10;
$_SESSION["form_tools_form"]["form_tools_submission_id"]; // e.g. 125; 

So in other words, EVERYTHING about that form submission is found in $_SESSION["form_tools_form"].

If you need to load multiple form information on the same page, you'd need to change the namespace to prevent conflicts, e.g. storing the data here:

PHP Code:
$_SESSION["form_tools_form2"

You'll also need to let all the other API functions know that you're using a custom namespace by feeding them that value. Here's some example calls:

PHP Code:
// form_tools_form_9 is our new namespace 
ft_api_init_form_page(9$pp["mode"], "form_tools_form_9"); 

// pass in the custom namespace
$params = array(
  
// ... other vals here
  
"namespace" => "form_tools_form_9"
  
);
ft_api_process_form($params);

// tell the session clearing function to empty sessions for this custom namespace
ft_api_clear_form_sessions("form_tools_form_9"); 

Hope this is kind of clear. One thing: be sure to only feed in that custom namespace for the SECOND form's API function calls.

- Ben
Reply
#5
Hi Ben!

Thanks for the explanation...I'll read through that and try it when I get a chance...however the way I did this above works for me...but maybe only because of the following conditions:
1. One of the forms has input from the user...the other is just a button, so maybe I have them in the right order to not overwrite the form that takes in data from the user.

2. Since they are single page forms, I don't need to worry about sessions at all on this for refilling form info if the user navigates back.

Because this is is the improper way to do this, I will certainly try to implement what you gave as the explanation...but for now (because of a deadline) it seems to work so I'll just leave it.

Thanks for the help! :-)
Reply
#6
Huh! I'm very glad it works, but I must confess I'm rather surprised! Smile

All the best!

- Ben
Reply
#7
Hi Ben... I am having some weird issues with my form, like it is producing a 302 or 304 (I forget which now today...basically the one saying it's already been initialized) and it probably has to do with the way I left it above.

So now I'm going to just do it the correct way haha! Just one question about what you wrote out:
would this be how I get the namespace all set up for my example? :
Code:
$fields_8 = ft_api_init_form_page(8, $pp["mode"], "form_tools_form_8");
$fields_9 = ft_api_init_form_page(9, $pp["mode"], "form_tools_form_9");

if (isset($_POST['form_9_submit'])) {

    if ($pp["mode"] == "initialize") {
        $params = array(
            "namespace" => "form_tools_form_9"
            "submit_button" => "send",
            "next_page" => "/form-9-success",
            "form_data" => stripslashes_deep($_POST),
            "finalize" => true
        );
    } else {
        $params = array(
            "namespace" => "form_tools_form_9"
            "submit_button" => "send",
            "next_page" => "/form-9-submit",
            "form_data" => stripslashes_deep($_POST),
        );
    }
    ft_api_process_form($params);
} else if (isset($_POST['form_8_submit'])) {

    if ($pp["mode"] == "initialize") {
        $params = array(
            "namespace" => "form_tools_form_8"
            "submit_button" => "approve",
            "next_page" => "/form-8-success",
            "form_data" => stripslashes_deep($_POST),
            "finalize" => true
        );
    } else {
        $params = array(
            "namespace" => "form_tools_form_8"
            "submit_button" => "approve",
            "next_page" => "/form-8-submit",
            "form_data" => stripslashes_deep($_POST),
        );
    }
    ft_api_process_form($params);
}

And then on my "Thank you" and "Cancel" pages I would have either:
Code:
ft_api_clear_form_sessions("form_tools_form_9");

or

Code:
ft_api_clear_form_sessions("form_tools_form_8");


Would I need to do anything special to the Submit or IPN pages as well? Currently I'm simply overriding the form id, success url, cancel url and notify url parameters passed by the library since I'm using the same library file for each one.
Reply
#8
Hey Jaace,

Hah - oh well. Smile Yes, the way you've added it looks pretty good to me. How is it working? Like I said, I haven't tested this in a loong time so I'd be curious to know how you get along.

And no, you don't have any to make any other changes to the submit or IPN pages. As long as they worked before they'll continue to work now. The namespacing stuff was just so that the two form data were stored independently; it shouldn't affect anything beyond that.

- Ben
Reply
#9
(Mar 10th, 2010, 6:00 AM)Jaace Wrote: <snip>
would this be how I get the namespace all set up for my example? :
Code:
$fields_8 = ft_api_init_form_page(8, $pp["mode"], "form_tools_form_8");
$fields_9 = ft_api_init_form_page(9, $pp["mode"], "form_tools_form_9");

if (isset($_POST['form_9_submit'])) {

    if ($pp["mode"] == "initialize") {
        $params = array(
            "namespace" => "form_tools_form_9"
            "submit_button" => "send",
            "next_page" => "/form-9-success",
            "form_data" => stripslashes_deep($_POST),
            "finalize" => true
        );
    } else {
        $params = array(
            "namespace" => "form_tools_form_9"
            "submit_button" => "send",
            "next_page" => "/form-9-submit",
            "form_data" => stripslashes_deep($_POST),
        );
    }
    ft_api_process_form($params);
} else if (isset($_POST['form_8_submit'])) {

    if ($pp["mode"] == "initialize") {
        $params = array(
            "namespace" => "form_tools_form_8"
            "submit_button" => "approve",
            "next_page" => "/form-8-success",
            "form_data" => stripslashes_deep($_POST),
            "finalize" => true
        );
    } else {
        $params = array(
            "namespace" => "form_tools_form_8"
            "submit_button" => "approve",
            "next_page" => "/form-8-submit",
            "form_data" => stripslashes_deep($_POST),
        );
    }
    ft_api_process_form($params);
}

And then on my "Thank you" and "Cancel" pages I would have either:
Code:
ft_api_clear_form_sessions("form_tools_form_9");

or

Code:
ft_api_clear_form_sessions("form_tools_form_8");

I am trying to do the same thing and just a bit confused about the $pp["mode"] parameter. Does this value get passed from the API depending on where you are in the process of setting up your form? Or, do we have to add the value somewhere here? I tried leaving this statement as the following:

Code:
$fields_10 = ft_api_init_form_page(10, $pp["initialize"], "form_tools_form_10");
but that threw a 200 error. I then tried:
Code:
$fields_10 = ft_api_init_form_page(10, "initialize", "form_tools_form_10");
but then that screws up the logic of the following if/then statement.

Sorry if I am being dull, but how did you set that value?

Dave
Reply
#10
Hi Dave,

Not sure if you're using the Paypal enabled form functionality...but that's why I have the if-else statement on mine and pp["mode"]. In Ben's documentation of Paypal his demo files are set up like this so that you don't have to worry about changing that field except in the library.php file. It tests to see if it's in initialize mode (set up) and if so, executes that statement...if not (live mode) it goes to the else statement.

Short answer... I believe yours should read:
Code:
$fields_10 = ft_api_init_form_page(10, "live", "form_tools_form_10");

...or if you have $pp["mode"] set to "live" ($pp["mode"]= "live"Wink
Code:
$fields_10 = ft_api_init_form_page(10, $pp["mode"], "form_tools_form_10");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)