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
(RESOLVED - Updated With Fix) Unable to Setup a Simple API Form - Can Anyone Help?
Thank you for taking the time to look at this.

Form Tools is wonderful, but I am totally blocked (and ripping my hair out). I spent more then 8 hours tinkering, combing the docs and this forum, I have tried endless variations, but I cant get this (simple) API form to return any response but a blank page.

Internal forms with my own custom forms, or the Auto-Generated type, are working perfectly - just cant make that next leap to api.

Can anyone offer some suggestions?
Most appreciatively,

Form draws correctly if I remove this first block of php code from top of page...
Regarding Paths: This is the url to the form

$fields = ft_api_init_form_page("", "test");
$params = array("submit_button" => "submit_button",
"next_page" => "posforms/result.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"finalize" => true

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Sample Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<!-- Form Tag... -->

<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">

<!-- Field Definitions... -->

<input type="text"
value="<?=htmlspecialchars(@$fields["fullname"])?>" />

<input type="text"
value="<?=htmlspecialchars(@$fields["email"])?>" />

<input type="text"
value="<?=htmlspecialchars(@$fields["comments"])?>" />

<!--Additinal Script Parameters -->

<input type="hidden" name="form_tools_form_id" value="" />
<input type="submit" name="submit_button" value="Submit Form" />

<!-- _____________________ -->

I have it working!!!
I'm not sure there is a 'solution', since I'm not sure there is a problem. It is more likely an LNBK issue (Loose Nut Behind Keyboard)

The Solution:

Its the paths
(Relative, Absolute, and something I don't know what to call).

I read this in the tutorial:
"The path to the api.php file has to be updated, depending on where it's located in relation to your form"
I took that to mean a relative path, which I thought works like this.
If the Path to the form is: /sitetools/formtools/forms/filename.php
A relative path would be: /formtools/global/api/api.php.
It seems I have the wrong understanding of the meaning of 'relative path', or the type of path to use (absolute?), or both.

Anywho, I tried (what I believe is) an absolute:
But alas, there was no joy in Mudville.

I had noticed people in the forums using this:
I have never used this type of path as a file reference to a web page, it would not have occurred to me.
But, I tried it out in the 3 file references at issue:
require_once (on result page)
require_once (on Form Page)
$params > next_page (on Form Page)

Quoth Bullwinkle, "this time, for sure!".
But i defiantly had the wrong hat.

The Solution (if you want to call it that - it feels like spit and bubble gum to me) was using the correct path types for the correct file references. Using the same path format for all three file references did not work (for me). It was only when I accidentally left the path formats inconsistent, that I started getting responses on submits, and realized the path types were mix n' match.

From there, it was not long before I found the correct combination (which works for me anyway):
require_once (on result page) uses a path like: /home2/UserAcct/public_html/projectName/formtools/etc...
require_once (on Form Page) same type of path as above
$params > next_page (on Form Page) = /formtools/global/posforms/posresult.php

It looked to me like other combinations might work, and maybe this is not the correct solution. But I had lost enough time on this and had better just move on to the next part.
(after sharing my results and thanking you all for your help - if not on this issue, then the next one)

Thank you!!!
Hey Jim,

Thanks for returning and posting your solution. We're all LNBK sometimes.



Forum Jump:

Users browsing this thread: 1 Guest(s)