Jul 12th, 2009, 9:33 AM
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?
The following warnings occurred: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Outputting info on thank you page
|
Jul 12th, 2009, 9:33 AM
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?
Jul 12th, 2009, 10:23 AM
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 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 /> Hope this helps - Ben
Jul 12th, 2009, 12:34 PM
Code: First Name: <?=$fields["first_name"]?><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 /> And how do I get the anwsers from a multi-select? If I do this: Code: <?=@$fields["categories[]"]?> 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?
Jul 12th, 2009, 10:48 PM
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"])) { ?> All the best - Ben
Jul 13th, 2009, 6:26 AM
Thank you for this! Works great!
|
« Next Oldest | Next Newest »
|