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
Calling a php script when form is submitted
#1
Hi!

I'm willing to have a script started when the user submit his form.

The php code is in a separate file I'd like to call, and uses many other librairies and variables from the form.

I can't get it done. I've looked through the hook manager module, but I can't have it work properly...

Any ideas?

Thanks for the help!
Reply
#2
Is this for an internal form or an external form?
Reply
#3
It's for an external form
Reply
#4
For an external form, the easiest way i have found is tois to call it in the thank you page. What kind of script are you running on submit?
Reply
#5
Thanks for the reply. I'm pretty new in using formtools. Do you mean directly inserting the script in "publish/THANKYOU PAGE CONTENT" (form builder module)?

It's this kind of script (month being a $ of the form):

Code:
<?php
require_once './PHPWord/PHPWord.php';

$PHPWord = new PHPWord();

$document = $PHPWord->loadTemplate('./Template/template.docx');

$document->setValue('Value1', 'month');

$document->save('./Contract/$month.docx');
?>

I wanted to attach the file created directly with the email sent
Reply
#6
Ahh gotcha, I always forget about the formbuilder module. I would have to do some research on how that works, I've never used it. I know it has some reduced flexibility when it comes to stuff like this. If I have time tonight I'll take a look and see if there's an easy way to do it.

Check out http://modules.formtools.org/form_builde...nkyou_page

You may be able to insert it in the template there.
Reply
#7
Ok thanks!

couldn't find where/which template I should insert it in...

Do you have any ideas?
Reply
#8
http://modules.formtools.org/form_builde..._form_page

I'm not in front of my computer but this should help. Let me know if you can't find it.
Reply
#9
Yep found it! Thanks!

Looks like I need to add {{ and }} to every line to get it interpreted, right?
Reply
#10
I'm not sure. I really need to play with formbuilder so I can help answer some of these questions!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)