Posts: 4
Threads: 2
Joined: Mar 2010
Reputation:
0
Mar 23rd, 2010, 4:08 PM
I have a 35 question form that has a lot of info to be entered into. I would like to pass all this info onto my success page for printing. Prob is if the user enters more than a couple of sentences, the form gets stuck in the process.php and doesnt make its final redirect url. Any suggestions?
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hi Tony,
Ah, interesting one. I assume you're using the "direct" method - posting your form to process.php?
Web browsers have their own limitations for the maximum length of a GET query string. I think Safari and Chrome have something like 2-3 thousand, IE 1500. So if the query string is anything in that range you may have a problem.
Let me know if that sounds about right. If so, I'll write up a tutorial to explain how to do it. It's a little lengthy to explain here.
- Ben
Posts: 4
Threads: 2
Joined: Mar 2010
Reputation:
0
Hello Ben,
Thanks for getting back to me. You described exactly the problem I'm having. Please let me know any ideas you have to get around it. Thank you.
-Tony
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hey Tony,
Sure, no problem. I'm just working on a tutorial for this - I'll try and wrap it up today or tomorrow. Keep you posted!
- Ben
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hi Tony,
Here we go: http://docs.formtools.org/tutorials/post...rect_data/
Let me know if I'm not clear on any of it!
- Ben
Posts: 4
Threads: 2
Joined: Mar 2010
Reputation:
0
Your tutorial was great. I followed it explicitly. I think everything is now setup correctly. The one problem that I am having is that there is nothing being "passed on" from my form to my success page. The form works correctly, and I am able to get to my success page just fine. But there is nothing in the query string that would show the submission ID and the unique key are getting passed on. Only my original URL. I will post some info below. Hopefully, you can figure out the issue from there. Thank you.
Form php code:
<?php
require_once("../NewForms/global/api/api.php");
$fields = ft_api_init_form_page(3);
$params = array(
"submit_button" => "Submit",
"next_page" => "success_GDF.php",
"form_data" => $_POST,
"finalize" => true
);
ft_api_process_form($params);
?>
//pasted at the very top of my code
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
//pasted in the body of my form
Success page php code:
<?php
require_once("../NewForms/global/api/api.php");
$fields = ft_api_init_form_page();
ft_api_clear_form_sessions();
?>
//pasted at the very top of my code
<?php
if (isset($_GET["submission_id"]) && isset($_GET["unique_key"]))
{
$form_id = 3;
$view_id = 3;
$export_type_id = 1;
$submission_info = ft_api_get_submission($form_id, $_GET["submission_id"]);
// now confirm that the unique_key matches
if (isset($submission_info["unique_key"]) &&
$submission_info["unique_key"] == $_GET["unique_key"])
{
ft_api_show_submission($form_id, $view_id, $export_type_id, $_GET["submission_id"]);
}
}
?>
//pasted in the body of my form
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Ah, sure no problem!
I didn't realize you were using the API. To pass values to the receipt page using the API, you need to manually append them to the "next_page" value. So try something like this:
PHP Code: <?php require_once("../NewForms/global/api/api.php"); $fields = ft_api_init_form_page(3);
$submission_id = $fields["form_tools_submission_id"]; $unique_key = $fields["unique_key"];
$params = array( "submit_button" => "Submit", "next_page" => "success_GDF.php?submission_id=$submission_id&unique_key=$unique_key", "form_data" => $_POST, "finalize" => true ); ft_api_process_form($params); ?>
I think I got that right... let me know if you have any trouble!
- Ben
Posts: 8
Threads: 2
Joined: Jul 2010
Reputation:
0
Hi Ben-
I am having the same sort of issue.... i have the form all set up, it is submitting the info into the database, and it is moving on to the next page fine, but it is not passing all the information on to the next page. The submission_id goes through ok, but the unique_key does not get passed through. It is being generated and put into the submission just fine, and if I go into the table and pull it out and append it to the url with it does pull up the proper information. I have checked and the field is set to be passed on.
Here is the code from the top of my form page:
require_once("../webadmin/formtoolsnew/global/api/api.php");
$fields = ft_api_init_form_page(3);
$submission_id = $fields["form_tools_submission_id"];
$unique_key = $fields["unique_key"];
$params = array(
"submit_button" => "Submit",
"next_page" => "acquisitions.thanks.php?submission_id=$submission_id&unique_key=$unique_key",
"form_data" => $_POST,
"finalize" => true
);
ft_api_process_form($params);
and here is the code from my receipt page:
<?php
if (isset($_GET["submission_id"]) && isset($_GET["unique_key"]))
{
$form_id = 3;
$view_id = 3;
$export_type_id = 3;
$submission_info = ft_api_get_submission($form_id, $_GET["submission_id"]);
// now confirm that the unique_key matches
if (isset($submission_info["unique_key"]) &&
$submission_info["unique_key"] == $_GET["unique_key"])
{
ft_api_show_submission($form_id, $view_id, $export_type_id, $_GET["submission_id"]);
}
}
?>
Any thoughts?
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hi wsargent.
Huh! Your code looks fine to me. So when it redirects, what does the query string look like? Does it just end with unique_key= ?
Hmmm... though re-reading the above, something doesn't look right with my last post...
Would you mind trying this? After the $fields = ft_api_init_form_page(3); line add this:
PHP Code: if (isset($_POST["Submit"])) { print_r($fields); exit; }
Then resubmit the form. Mind checking to see if the unique_key contains a value in the outputted content? (just View Source on your webpage to see the info in a slightly more readable format!)
I suspect it won't be there...
- Ben
Posts: 8
Threads: 2
Joined: Jul 2010
Reputation:
0
Hi Ben-
This is what my success page url looks like:
thanks.php?submission_id=31&unique_key=
So it is pulling in the submission_id just not the unique_key... which is way weird.
If I put that in to the page that contains the form, when I submit it, I get:
Array
(
[form_tools_form_id] => 3
[form_tools_submission_id] => 30
)
Hope that helps...
|