The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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.31 (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
Weird: form submitting into another forms's DB
#1
Sad 
I recently created a duplicate of an existing form. The new form contained a few new fields, but is otherwise identical. My goal was to continue using the existing form while I make edits to the new form.

I successfully created the new form through the Form Tools wizard, and each form has a unique ID. A quick peak into the database reveals that there is a table for each form. I also have a unique "thank you" page for each form. So far so good.

However, when I submit the new form it enters the values into the table of the old form and sends out an email that is tied to the old form. I temporarily disabled the old form in hopes that the new form might go through correctly, but I get a 303 error.

The $fields values are correctly set in both files, so I'm not sure where to look next.
Reply
#2
If you are going to have multiple forms, you need tomake sure that each one has unique field names, otherwise you may get "crosstalk" between them if both are active at the same time. I found that out the hard way because the sessions info was being overwritten because the fields names were the same in both forms, regardless that they both had unique ID's.

I know it's a pain, but go through one of them and make all the fields names unique and there is no duplication between the two forms.

Odd, because a 303 error is that the form has been disabled, so it shouldn't be uploading anything. Rename all the field names in the new form, edit the database for it accordingly and see if that fixes it.
Reply
#3
(May 25th, 2011, 7:32 PM)JMW Wrote: If you are going to have multiple forms, you need tomake sure that each one has unique field names, otherwise you may get "crosstalk" between them if both are active at the same time. I found that out the hard way because the sessions info was being overwritten because the fields names were the same in both forms, regardless that they both had unique ID's.

I know it's a pain, but go through one of them and make all the fields names unique and there is no duplication between the two forms.

Odd, because a 303 error is that the form has been disabled, so it shouldn't be uploading anything. Rename all the field names in the new form, edit the database for it accordingly and see if that fixes it.

JMW - Thanks for the suggestion. The field name are indeed identical. I'll update the fields and post back with the results.
Reply
#4
Hi guys,

I sat down to look at this tonight & to come up with a decent solution, and it turns out I'd actually already added one in (!). I'm so sorry for not mentioning it sooner, but quite honestly I don't remember adding it. I just tested it out and it seems to work fine.

I'll this up in much more detail in a tutorial, but for now, here's how to configure it properly to allow you to have users submitting multiple API forms at the same time and not get the session data mixed.

These are the three functions that you use for API forms:
ft_api_init_form_page
ft_api_process_form
ft_api_clear_form_sessions

All three of them allow you to pass in a unique namespace that will be used for a particular form. A "namespace" is just a way to partition something off from other things.

What you'll need to do is come up with a string for each form (e.g. "form1" and "form2" - that will act as your namespace). Then make the following changes to your function calls. The following is for your first form (which we're going to give a "form1" namespace).

Code:
// 1. Change this line on EVERY page:
ft_api_init_form_page(X); // X is your form ID (or it's not explicitly passed)

// to this:
ft_api_init_form_page(X, "live", "form1"); // same on every page


// 2. in the $params passed to your ft_api_process_form() function, add in an
// extra key-value pair: "namespace" => "form1" (again, on EVERY page)

// 3. On your final page, change this:
ft_api_clear_form_sessions();

// to this:
ft_api_clear_form_sessions("form1"); // this now only empties the sessions for form 1

Then do exactly the same thing for your second form, only with the "form2" namespace.

And that should be it...

Do let me know how it goes.

- Ben
Reply
#5
Hello Ben,

I have used your functions into my forms. However, when one field of the form is entered correctly while the other is not the error displays correctly for the incorrect entry but all the field entries (even the correct ones) disappear!

Could you advise please?

On my contact Page:

<?php
require_once("/..../...../ftoolslgobal/api/api.php");
$fields = ft_api_init_form_page(X, "live", "myform");
$errors = array();
if (isset($_POST['submit2']))
{
$rules = array();
$rules[] = "required,fname,I need your name!";
$rules[] = "required,sname,I need your surname!";
$rules[] = "required,email,I need your contact email address!";
$errors = validate_fields($_POST, $rules);
if (empty($errors))
{

$params = array(
"submit_button" => "submit2",
"next_page" => "thankyou.php",
"form_data" => $_POST,
"finalize" => true,
"namespace"=>"myform"
);

ft_api_process_form($params);
}
else
{
$fields = array_merge($_SESSION["form_tools_form"], $_POST);
}
}

?>

On my thank you page:

<?php
require_once("/...../...../......./ftools/global/api/api.php");
$fields = ft_api_init_form_page();
ft_api_clear_form_sessions ("myform");
?>


many thanks
Alok

(May 28th, 2011, 2:25 PM)Ben Wrote: Hi guys,

I sat down to look at this tonight & to come up with a decent solution, and it turns out I'd actually already added one in (!). I'm so sorry for not mentioning it sooner, but quite honestly I don't remember adding it. I just tested it out and it seems to work fine.

I'll this up in much more detail in a tutorial, but for now, here's how to configure it properly to allow you to have users submitting multiple API forms at the same time and not get the session data mixed.

These are the three functions that you use for API forms:
ft_api_init_form_page
ft_api_process_form
ft_api_clear_form_sessions

All three of them allow you to pass in a unique namespace that will be used for a particular form. A "namespace" is just a way to partition something off from other things.

What you'll need to do is come up with a string for each form (e.g. "form1" and "form2" - that will act as your namespace). Then make the following changes to your function calls. The following is for your first form (which we're going to give a "form1" namespace).

Code:
// 1. Change this line on EVERY page:
ft_api_init_form_page(X); // X is your form ID (or it's not explicitly passed)

// to this:
ft_api_init_form_page(X, "live", "form1"); // same on every page


// 2. in the $params passed to your ft_api_process_form() function, add in an
// extra key-value pair: "namespace" => "form1" (again, on EVERY page)

// 3. On your final page, change this:
ft_api_clear_form_sessions();

// to this:
ft_api_clear_form_sessions("form1"); // this now only empties the sessions for form 1

Then do exactly the same thing for your second form, only with the "form2" namespace.

And that should be it...

Do let me know how it goes.

- Ben

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)