Hi,
I am attempting to create my first multi-page form using the API, but I am going crazy and getting nowhere.
I have created other internal forms in form tools without issue as well as other forms in general, but am having real issues with the API.
I believe I am following the instructions exactly as outlined in the docs, plus trying a few other things that seem more logical after the initial tests did not work.
For example, this is what I currently have at the top of my first page (above the <!DOCTYPE HTML);
<?php
require_once("/home/mysite/public_html/ftools/global/api/api.php");
$fields = ft_api_init_form_page(5, "initialize");
$params = array(
"submit_button" => "Submit",
"next_page" => "mbh_competitive_index_1.php",
"form_data" => $_POST
);
ft_api_process_form($params);
?>
Now strictly speaking, the docs ONLY say to have;
$params = array(
"submit_button" => "submit_button_name_attribute",
"next_page" => "next_page.php",
"form_data" => $_POST
);
(I have no file upload fields)
- on your first page instructions. Which I tried out of fun, and that didn't work, so I wrapped it in <?php ?> and that didn't work either so I then extended it to what I have above - otherwise how does the first page even get the api.php code to process the form? But anyway, that is not working either.
Interestingly, when I tried to delete "$fields = ft_api_init_form_page(5, "initialize");" from the line above, I got a 300 error, so there is a connection trying to take place somewhere.
My form code line is; <form id="create-competitive-answers" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST"> - pretty much as directed.
Plus my button code is; <input type="submit" class="button" name="Button1" value="Submit" />
On the first page of the form, I only have three hidden fields and one select and they are all properly coded.
When you complete the select field and hit the "Submit" button the page refreshes, but does not proceed to the next page - nor does the selection remain in the select field. Everything just reverts back to what what was initially there. I get no error message either.
I have tried just continuing on manually through all the other form pages but at no time does the script take me to the next page or the "Success!" page, and nothing is registered at Step 3, other than tell me that the line of PHP you will need is:
$fields = ft_api_init_form_page(5, "initialize"); - which I have included on all pages.
I have also tried putting the full URL into the "next_page" -> variable without success.
Sadly, there seems nothing in the docs or on this forum that seem to be able to help me further, so any assistance would be greatly appreciated.
Thanks kindly,
- Neil
OK, sorry, I think I just found it, with the problem being with my button name. :?
I am attempting to create my first multi-page form using the API, but I am going crazy and getting nowhere.
I have created other internal forms in form tools without issue as well as other forms in general, but am having real issues with the API.
I believe I am following the instructions exactly as outlined in the docs, plus trying a few other things that seem more logical after the initial tests did not work.
For example, this is what I currently have at the top of my first page (above the <!DOCTYPE HTML);
<?php
require_once("/home/mysite/public_html/ftools/global/api/api.php");
$fields = ft_api_init_form_page(5, "initialize");
$params = array(
"submit_button" => "Submit",
"next_page" => "mbh_competitive_index_1.php",
"form_data" => $_POST
);
ft_api_process_form($params);
?>
Now strictly speaking, the docs ONLY say to have;
$params = array(
"submit_button" => "submit_button_name_attribute",
"next_page" => "next_page.php",
"form_data" => $_POST
);
(I have no file upload fields)
- on your first page instructions. Which I tried out of fun, and that didn't work, so I wrapped it in <?php ?> and that didn't work either so I then extended it to what I have above - otherwise how does the first page even get the api.php code to process the form? But anyway, that is not working either.
Interestingly, when I tried to delete "$fields = ft_api_init_form_page(5, "initialize");" from the line above, I got a 300 error, so there is a connection trying to take place somewhere.
My form code line is; <form id="create-competitive-answers" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST"> - pretty much as directed.
Plus my button code is; <input type="submit" class="button" name="Button1" value="Submit" />
On the first page of the form, I only have three hidden fields and one select and they are all properly coded.
When you complete the select field and hit the "Submit" button the page refreshes, but does not proceed to the next page - nor does the selection remain in the select field. Everything just reverts back to what what was initially there. I get no error message either.
I have tried just continuing on manually through all the other form pages but at no time does the script take me to the next page or the "Success!" page, and nothing is registered at Step 3, other than tell me that the line of PHP you will need is:
$fields = ft_api_init_form_page(5, "initialize"); - which I have included on all pages.
I have also tried putting the full URL into the "next_page" -> variable without success.
Sadly, there seems nothing in the docs or on this forum that seem to be able to help me further, so any assistance would be greatly appreciated.
Thanks kindly,
- Neil
OK, sorry, I think I just found it, with the problem being with my button name. :?