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
API Submission
#1
I am trying to submit a form using the API Code submission. I cannot get the form to initialize. This is my first attempt using code and CAPTCHA combined. I must be missing something very simple but it all looks correct. Any help would be appreciated. Sorry for all the code.

CODE:

config.php file
<?php

// main program paths - no trailing slashes!
$g_root_url = "./data/";
$g_root_dir = "/home/site/public_html/data";
$g_api_recaptcha_private_key = "xxxxxxxxxxxxxx";
$g_api_recaptcha_public_key = "yyyyyyyyyyyyyy";

// database settings
$g_db_hostname = "localhost";
$g_db_name = "";
$g_db_username = "";
$g_db_password = "";
$g_table_prefix = "ft_";


?>

FORM:

<?php
require_once("/home/site/public_html/data/global/api/api.php");
$fields = ft_api_init_form_page(1, "initialize");
$params = array(
"submit_button" => "Place Bid",
"next_page" => "/home/site/public_html/nightfall/",
"form_data" => $_POST,
"finalize" => true
);
ft_api_process_form($params);
?>

FORM ACTION:

<form action="<?=$_SERVER["PHP_SELF"]?>" method="post">
Reply
#2
Hey bwaye,

First thing is to update the $g_root_url. This need to be an absolute path to the Form Tools root folder - without the trailing slash. If you include a relative path, it won't redirect properly in certain cases.

Second, change the name attribute of your submit button to "Place_Bid" (note the underscore). The value attribute can remain as "Place Bid", but the name can't contain any spaces. Once that's done, update the "submit_button" => "Place Bid" line to include the underscore too.

That should fix it up! Smile

- Ben
Reply
#3
Ben,

Thanks for the quick response. I made the changes as reflected below. When I submit the form the data is cleared and returned to the same form. I am at a loss as everything appears correct on my end.


MAIN FORM:

<?php
require_once("/home/cdp/public_html/data/global/api/api.php");
$fields = ft_api_init_form_page(1, "initialize");
$params = array(
"submit_button" => "submit",
"next_page" => "/home/cdp/public_html/thanks/index.php",
"form_data" => $_POST,
"finalize" => true
);
ft_api_process_form($params);
?>

THANKS PAGE:

<?php
require_once("/home/cdp/public_html/data/global/api/api.php");
$fields = ft_api_init_form_page();
ft_api_clear_form_sessions();
?>

CONFIG:


// main program paths - no trailing slashes!
$g_root_url = "http://www.downtownchattanooga.org/data";
$g_root_dir = "/home/cdp/public_html/data";
$g_api_recaptcha_private_key = "6XXXXXXXXXXXXXXXXXXXXXXXXXXX";
$g_api_recaptcha_public_key = "66666666666666666666666666666";

// database settings
$g_db_hostname = "localhost";
$g_db_name = "XXXXX";
$g_db_username = "XXXXX";
$g_db_password = "XXXXXXX";
$g_table_prefix = "ft_";


?>
Reply
#4
Hey bwaye,

When that happens, the most likely cause is that your form submit button has a different name attribute value than the value specified. Make sure your form submit button looks like this:

Code:
<input type="submit" name="submit" value="Place Bid" />

Also, you're not disabling the submit button when submitting the form are you? If so, you'll need to add a hidden field to the form and specify THAT name attribute in the line:

PHP Code:
"submit_button" => "submit"

- Ben
Reply
#5
I removed the Place Bid to simplify the matter and added back the "submit" button. Low and behold I left the "Submit" capitalized. This was the problem. So remember class to always cross your T's and dot your I's.

<input type="submit" name="Submit" value="Submit" id="Submit" />
Reply
#6
Excellent! Smile
Reply
#7
For the benefit of other readers, I also had this problem. The issue for me was that I managed to have the name value before the type value. I reversed and all was well:

Corrected
Code:
<input name="submit_eval_cf_res" type="submit"  value="Submit Request">

Original
Code:
<input type="submit" name="submit_eval_cf_res" value="Submit Request">
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)