The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
Send data to form tools after successfully sending to SOAP webservice - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17) +--- Thread: Send data to form tools after successfully sending to SOAP webservice (/showthread.php?tid=412) |
Send data to form tools after successfully sending to SOAP webservice - st8 - Dec 26th, 2009 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: Code: <?php if ($result[[Message] == "OK" ) { ?> 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: Code: <?php if ($result[[Message] == "OK" ) { ?> Thank you for any help in advance! :-) RE: Send data to form tools after successfully sending to SOAP webservice - st8 - Dec 27th, 2009 Hmm, I'm having real problems trying to do this. I can get the forms in the database by using this code: Code: <?php if ($result[[Message] == "OK" ) { 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 RE: Send data to form tools after successfully sending to SOAP webservice - st8 - Dec 27th, 2009 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: Code: <?php 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! RE: Send data to form tools after successfully sending to SOAP webservice - Ben - Jan 5th, 2010 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 |