I am using an add-on Drupal module that invovles forms and php scripts.
As it stands, once a form is filled out, it updates the database. Of course.
I ALSO want it to send an email. That means I have to go in and tweak the code.
Where would I look to insert this email code? Can I do it right there in the form? Id like to (and leave the php written by people who actually know how to write it alone) but how would I trigger the send unless via the submit button?
If the form is submitted to formhandler.php (I actually think it is dynamically derived), can formhandler.php see every variable on the form? I could set a flag so it would know to send an email and just stick the email code in formhandler.php
Makes my head hurt.
Can I set a variable in the form that is not part of the form and pass it along in the submit?
Sorry.
another stupid question (adding functionality to submit)
Moderator: General Moderators
Which module are you talking about? Webform?I am using an add-on Drupal module that invovles forms and php scripts.
In modules/modulename.module.Where would I look to insert this email code?
You'll want to look in the module for a function called modulename_save() --- I think.If the form is submitted to formhandler.php (I actually think it is dynamically derived), can formhandler.php see every variable on the form? I could set a flag so it would know to send an email and just stick the email code in formhandler.php
Yes look in the module for a function called modulename_form()Can I set a variable in the form that is not part of the form and pass it along in the submit?
But of course before you do any of that I highly reccomend that you do some reading at api.drupal.org.
Okay let me try again... I am kind of out of it today and have not been clear.
This is really more of a question about how Php works.
My form submits TO a php file, right? I dont SEE any php at all on the form as it is. It looks like a regular html form. I dont know though. Would I see php? Or is it all on the file that receives it? (I cant actually find the file. It might be stored in the database somewhere).
And that file handles processing, gets passed ALL the variables on the form?
So there is no reason I couldnt modify the file to do extra processing, like sending emails before it is submitted to the database?
I can therefore pass variables (hidden fields) that the script is not now aware of... tack them on without doing any damage?
I am using an add-on module and I need to build more functionality into it. It does some seriously complicated database stuff, but I need it to do some other things (like send notification emails).
I appreciate your time.
This is really more of a question about how Php works.
My form submits TO a php file, right? I dont SEE any php at all on the form as it is. It looks like a regular html form. I dont know though. Would I see php? Or is it all on the file that receives it? (I cant actually find the file. It might be stored in the database somewhere).
And that file handles processing, gets passed ALL the variables on the form?
So there is no reason I couldnt modify the file to do extra processing, like sending emails before it is submitted to the database?
I can therefore pass variables (hidden fields) that the script is not now aware of... tack them on without doing any damage?
I am using an add-on module and I need to build more functionality into it. It does some seriously complicated database stuff, but I need it to do some other things (like send notification emails).
I appreciate your time.