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
How do I summarize data after entry
#1
After an email is submitted to myself and the user, I would like to redirect the user to a page that displays a summary of everything he/she had just filled out. Is this possible?

I have successfully installed the script on my server and am using the 'direct' submission method (non-api).

I have been looking high and low for a solution. Please help. thanks

John
Reply
#2
Hi John,

Sure! So would you like the email to contain a link to the summary page, or redirect automatically via the form?

But for the page itself, there's a handy API function that lets you do exactly this. It's totally fine to keep your form as a "direct" method, but the summary page will use the API. Give these two links a look over:

1. ft_api_show_submission documentation
http://docs.formtools.org/api/?page=ft_a...submission

2. an example with code:
http://demo.formtools.org/ (click on "ft_api_show_submission").

The trick is to pass the submission ID to the page so that it can be used in the function. This can be just passed via the query string ?submission_id=X.

Also, all of the above is assuming that security isn't a concern. If the information is private and you want to absolutely forbid hackers from viewing the information, we'll need to follow a slightly more stringent approach.

Sorry for the rather high-level help - let me know if you get stumped on anything & I'll try to lend a hand.

- Ben
Reply
#3
Ben,

Thanks a lot for your time and help! I am very happy to hear that what I want to do is possible.

I reviewed what you suggested and the matter seems a bit clearer. However, let me know if I have this straight. I have two pages. 1) my index.php where the form is filled out and 2) my success.php page.

First I should change the link in the submit button from formtools/process.php to formtools/process.php?submission_id=X ?

Second, I put <?php require("../formtools/global/code/api/api.php"); ft_api_show_submission(2, 2, 3, 14); ?> on the success page? As far as the #14 goes, is it left blank because each submission is a different ID? (not sure what to do here)

Third any of the fields that I want to appear on the success page I should write '{$ANSWER_email} ' and they will appear?

Finally, when I put the <?php require("../formtools/global/code/api/api.php"); ft_api_show_submission(2, 2, 3, 14); ?> on my success page, the page is blank from where I entered it on the page. What am I doing wrong?

I am not so concerned about the security, it's just email and regular addresses. However, if ordinary people visiting the site can see other peoples information easily I would be concerned.

Thank you in advance for help!

John
Reply
#4
Hey John,

Excellent! Sounds like you're making progress.

Quote:First I should change the link in the submit button from formtools/process.php to formtools/process.php?submission_id=X ?

Actually, not quite: Form Tools has the option for direct forms to redirect with whatever submission info you want to be passed via the query string. To set this up, in the Form Tools admin section go to the Edit Form -> Fields tab. There, the penultimate column is labeled "pass on" and has a bunch of checkboxes. Just check the field for "Submission ID". Now, Form Tools will automatically append ?submission_id=X when redirecting to your thankyou page. So far so good.

Quote:Second, I put <?php require("../formtools/global/code/api/api.php"); ft_api_show_submission(2, 2, 3, 14); ?> on the success page? As far as the #14 goes, is it left blank because each submission is a different ID? (not sure what to do here)

Now we know we have the unique submission ID available in the query string, we can just pull it out with PHP. The first three parameters can just be hardcoded like you're doing now, but the submission ID needs to be dynamic. Try this code:

PHP Code:
if (isset($_GET["submission_id"]) && is_numeric($_GET["submission_id"])) {
  
$submission_id $_GET["submission_id"];
  
ft_api_show_submission(223$submission_id);


And be sure to include your API at the top of the page somewhere.

Quote:Third any of the fields that I want to appear on the success page I should write '{$ANSWER_email} ' and they will appear?

Basically, yes. This bit may be a bit hard to explain because it's SO versatile, but here's the gist of it: the content that's generated in your page is determined by two components:
(1) The View you've chosen (determined by the View ID you've passed the function)
(2) The Export Manager module's export type.

The View lets you choose which fields appear and the export type determines the actual markup for displaying the content. So for example, if you wanted Field 1, 2, 4 and 7 to show up on the page, you'd first create a new View for your form that shows that information. Then, you'd either pass the export ID of an existing Export Manager export type. "Export types" are just chunks of markup with placeholders in them that are used to generate the final markup (HTML, XML, CSV or whatever else).

Boy, this sounds confusing when I type it out, but it makes sense once you fiddle with it a bit. It's separated like this because it lets you present your form information in virtually any way you need - but this complexity does lead to confusion, I'll admit.

Quote:Finally, when I put the <?php require("../formtools/global/code/api/api.php"); ft_api_show_submission(2, 2, 3, 14); ?> on my success page, the page is blank from where I entered it on the page. What am I doing wrong?

This sounds like a path problem. Check that the path you entered to the api.php file is correct. PHP require()'s function stops everything if it can't include the file specified.

Hope this info helps a bit...! Let me know if I wasn't clear on anything.

- Ben
Reply
#5
Ben,

Thanks a lot again for your quick reply!

I changed my success page's php to
Code:
<?php
require("../formtools/global/api/api.php");
if (isset($_GET["submission_id"]) && is_numeric($_GET["submission_id"])) {
  $submission_id = $_GET["submission_id"];
  ft_api_show_submission(2, 2, 3, $submission_id);
}
?>
like you suggested. I hope I wrote it correctly.

The success page seems to be working better than before, however none of the fields come up when I type {$ANSWER_email} on the page.

The view I've chosen is the default one, ID 2, 'All submissions'.

As for the export type, I chose the HTML / Printer-friendly -> 3,one submission per page. I am not sure what the difference is regarding the 3 choices and which would be most appropriate for what I want.

All I want to do is create an html table and input {$ANSWER_email}, {$ANSWER_name} etc.

Sorry for my lack of understanding. Again thanks for your help!

John
Reply
#6
Heya,

Hmm... that looks okay, actually! The export type you picked should be fine.

So nothing gets outputted by that function at all? No errors & no markup?

- Ben
Reply
#7
Ben,

There are no errors or markup at all. On my submit button I have entered
Code:
<input type="hidden" name="form_tools_form_id" value="2" />

The data entered in my form posts to the database fine.

The only problem is that nothing comes up when I write {$answer_email} on the thank you page.

In my fields I have Display text= Email, Form field= email, fieldtype = textbox, pass on= checked.

In view fields I have column & sortable = checked, editable = not checked, searchable = checked, display text = email, tab = data

Modules = changed nothing

Also it does say in the address bar on the thank you page-

Code:
mysite.com/reservation.php?item_name=Full Page %24360&os0=Congrats&os1=Test&os3=2&os4=joe&os5=larry&os6=&os7=&os8=&os9=&os10=&os11=&mrg1=Mr. %26 Mrs.&first_name=john&last_name=doe&address1=555 main st.&address2=&city=new york&country=US&state=NY&zip=10001&night_phone_a=212&night_phone_b=555&night_phone_c=5555&email=john%40doe.com&tot=%24360.00

What do you suggest?

John
Reply
#8
If this is just for viewing records by the week, then all you need is a relationship. It can even be a self-join relationship (there's no point in having a table of just dates). Use a global field to select an arbitrary date, have two calculation fields to determine the week's starting and ending date, and define the relationship to include only records in that week.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)