The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(257) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/printthread.php(257) : eval()'d code 2 errorHandler->error
/printthread.php 257 eval
/printthread.php 117 printthread_multipage
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Calling a php script when form is submitted - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: Calling a php script when form is submitted (/showthread.php?tid=17409)

Pages: 1 2


Calling a php script when form is submitted - Fazzax - Nov 16th, 2016

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!


RE: Calling a php script when form is submitted - alexh - Nov 16th, 2016

Is this for an internal form or an external form?


RE: Calling a php script when form is submitted - Fazzax - Nov 16th, 2016

It's for an external form


RE: Calling a php script when form is submitted - alexh - Nov 16th, 2016

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?


RE: Calling a php script when form is submitted - Fazzax - Nov 16th, 2016

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


RE: Calling a php script when form is submitted - alexh - Nov 16th, 2016

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_builder/?page=tt_thankyou_page

You may be able to insert it in the template there.


RE: Calling a php script when form is submitted - Fazzax - Nov 16th, 2016

Ok thanks!

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

Do you have any ideas?


RE: Calling a php script when form is submitted - alexh - Nov 16th, 2016

http://modules.formtools.org/form_builder/?page=tips_targeting_specific_form_page

I'm not in front of my computer but this should help. Let me know if you can't find it.


RE: Calling a php script when form is submitted - Fazzax - Nov 16th, 2016

Yep found it! Thanks!

Looks like I need to add {{ and }} to every line to get it interpreted, right?


RE: Calling a php script when form is submitted - alexh - Nov 16th, 2016

I'm not sure. I really need to play with formbuilder so I can help answer some of these questions!