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
Outputting info on thank you page
#1
I'm sure I must be missing it in the documentation but how exactly does one output the information provided by the person who is filling out the form on the "thank you" page when using the API?
Reply
#2
Heya,

Sure, this is no problem! On the final page, you should have something like this at the top of your page:

PHP Code:
<?php
require_once("path/to/global/api/api.php");
$fields ft_api_init_form_page();
ft_api_clear_form_sessions();
?>

To access any of the form field values, you can extract them from the $fields variable. For example, if your form contained "first_name" and "email" fields, you could just add this PHP to your page:

Code:
First Name: <?=$fields["first_name"]?><br />
Email: <?=$fields["email"]?><br />

Hope this helps -

Ben
Reply
#3
Code:
First Name: <?=$fields["first_name"]?><br />
Email: <?=$fields["email"]?><br />

Okay, I was doing it with an "@" sign preceding the $fields but if I remove it, it fails completely. I'm doing it like this:

Code:
<?=@$fields["first_name"]?><br />
<?=@$fields["email"]?><br />

And how do I get the anwsers from a multi-select? If I do this:
Code:
<?=@$fields["categories[]"]?>
...nothing gets output

If I do it without the brackets, I get the word "Array" output and nothing else.

And, if a field is left blank during the data entry, is there a way to conditionally make it so that nothing gets output on the thank you page?
Reply
#4
Good questions!

(btw, the @ symbol just prevents any warnings from being outputted to the screen if the variable isn't defined).

Displaying the values in multi-select works like this. First, drop the [] characters. It's weird, I know, but they're only used when submitting the data via a form - it tells the server to expect an array of values. Try this instead:

PHP Code:
<?=join(", "$fields["categories"])?>

It displays the values in $categories, separates by ", ".

Quote:And, if a field is left blank during the data entry, is there a way to conditionally make it so that nothing gets output on the thank you page?

Sure, here's an example.

Code:
<?php if (!empty($fields["first_name"])) { ?>
  First Name: <?=$fields["first_name"]?>
<?php } ?>

All the best -

Ben
Reply
#5
Thank you for this! Works great!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)