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:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Send data to form tools after successfully sending to SOAP webservice
Hi Ben,

Love the new formtools. I have been using the first form tools for over a year and now I am just starting to use FT 2.0 on a new project.

A client of mine is sending form data via a SOAP webservice. The webservice validates all the data and is sent to a networks database. My client also wants the form data to be sent to a database on their website.

I thought this would be an excellent time to use form tools again.

However, i'm having a problem sending the data.

Basically, on my form page I have this code, which comes into play after a user submits the form:

<?php if ($result[[Message] == "OK" ) { ?>


<?php  } else { ?>


<?php } ?>

So if the the form that has been submitted gets the ok from the SOAP webservice the user receives the "Thank you text".

It's at this point I want the data to be sent to form tools. I have the form data in variables, they are also in the $_POST['field'] variables.

Im having a problem because I don't need to use the "submit_button" or "next_page" variables, etc. I don't need form tools to redirect to a thank you page or anything like that.

Is it possible to simply send the data to form tools as it is in the background, if it has been successfully received by the SOAP webservice?

So something like:

<?php if ($result[[Message] == "OK" ) { ?>



<?php  } else { ?>

Thank you for any help in advance! :-)
Hmm, I'm having real problems trying to do this. I can get the forms in the database by using this code:

<?php if ($result[[Message] == "OK" ) {

$fields = ft_api_init_form_page(2, "initialize");
$params = array(
  "submit_button" => "submit",
  //"next_page" => "thanks.php",
  "form_data" => $_POST,
  //"file_data" => $_FILES,
  "finalize" => true




<?php  } else { ?>

But that gets a lot of errors referring to headers already being sent, as this code really needs to be at the top of the page.

But when I do that it interferes with the methods im calling for the SOAP function.

So if I could add some code in the same area as I tried above, then this would be ideal. I just need to get that data into the formtools database. Is there any manual code I could use?

If anyone can help I would really appreciate it.

Cheers :-P
OK, excellent looks like I have found away around this using Curl.

Instead of going through the form tools API, im using the process.php method and automatically sending the form, after a success message from the SOAP webservice, via Curl.

Here is the Curl code:


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);

$data = array(
    'foo' => 'foo foo foo',
    'bar' => 'bar bar bar',
    'baz' => 'baz baz baz'

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
$info = curl_getinfo($ch);


All the fields are in the $data array and this is where you would also put the hidden formtools fields, such as the initiate form and the form ID field.

It would have been nice to use the formtools API, but I guess this works as all I needed was to get the data into formtools somehow.

Anyone have any opinions about this method, is it good or would you recommend another approach?

Happy new year!
Very interesting! That's actually not a bad approach at all - but I do agree, the API should contain an option to do it automatically.

I have no objections to your approach, though.

- Ben

Forum Jump:

Users browsing this thread: 1 Guest(s)