The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
|
![]() |
can i send an email if i insert a record with php? - 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: can i send an email if i insert a record with php? (/showthread.php?tid=1799) |
can i send an email if i insert a record with php? - carpetman - Dec 5th, 2011 Hi everyone, My website has grown somewhat since i started using Form Tools and the more i use it the more fantastic ideas i come up with. A year down the track and i'm happily using the data in ways i never imagined (probably childs play for some of you programmers but i'm a humble carpet cleaner). So here is my problem - I think the answer is i cant do it this way but maybe someone out there has a suggestion. I wrote some php code to add a record in mysql . The record is normally added with a 'post' form submission to a database in formtools where it trickers an email, a mobile text message to the client and redirects the webpage to somewhere suitable. The problem is when adding a record with php i'm not getting the email or text message. I'm guessing its because the record isnt being submitted as a form post but does anyone have any ideas as to how i can get formtools to send the email and text this way? Thanks Rob RE: can i send an email if i insert a record with php? - carpetman - Dec 5th, 2011 ok i downloaded some script but it didnt work grrrr so i'm going to try and set up a hidden form to see if this works - it will duplicate the existing form on the same page but php will replace the first one with the hidden one when needed. The idea is the user clicks the button without seeing the sensitive data behind it. I'll keep you posted but if someone else has a better idea i'd be happy to hear it. RE: can i send an email if i insert a record with php? - Ben - Dec 6th, 2011 Hi Carpetman, Cool! No problem, here's how you can trigger it manually. The emails are "normally" triggered in the ft_finalize_submission() function, called when the submission is finally marked as complete & ready to show up in the interface. But in your case, you can just call the email function manually. Here's some example code: PHP Code: // your insert code here Hope this helps! ![]() - Ben RE: can i send an email if i insert a record with php? - carpetman - Dec 6th, 2011 (Dec 6th, 2011, 10:35 AM)Ben Wrote: Hi Carpetman, OMG You are a genious!! Many thanks - i have many other uses for this so it's going to be a late night in front of the computer ![]() I'm guessing the ft_send_emails("on_submission", $form_id, $submission_id); is caling the function so i need to declare it before? and i'm guessing the function is somewhere in my formtools directory. I'll give it a go and tell you how it works. Once again, many thanks for this. RE: can i send an email if i insert a record with php? - carpetman - Dec 9th, 2011 (Dec 6th, 2011, 10:35 AM)Ben Wrote: Hi Carpetman, Hi Ben, I added this to a test page: include("formtools/global/code/emails.php"); include("formtools/global/code/hooks.php"); include("formtools/global/code/fields.php"); ft_process_email_template('1','1007','23'); and i'm getting this errror: Access denied for user 'carpetc7'@'localhost' (using password: NO) Any chance of putting me in the right direction? I'm guessing the formtools code is querying mysql and doesnt have the password because i havent logged in. Thanks Rob Oops - forget that - i know what i'm missing. I am getting error after error but i'm working through them. I may need a bit of help if i get stuck though ![]() ok i got this error now Table 'carpetc7_formtools.form_fields' doesn't exist i checked mysql and i have table ft_form_fields but its looking for form_fields any ideas RE: can i send an email if i insert a record with php? - carpetman - Dec 10th, 2011 ok i got it - it needs the library include("formtools/global/library.php"); $form_id=1; $submission_id=1016; $email_id=1; ft_process_email_template($form_id, $submission_id, $email_id); cool - now i can set the form , email and submission variables as needed in my code. Thanks Ben RE: can i send an email if i insert a record with php? - javiervgn - Jul 1st, 2016 (Dec 10th, 2011, 9:37 AM)carpetman Wrote: ok i got it - it needs the library You all are genius, this is exactly what I needed. Thanks!! |