How to add some php code ?
I'm a beginner in Concrete 5 and till now, I have only added HTML code (Add block -> Content) but now I need to add some php code in a block and I know it's impossible to add directly...
Actually, I want to execute the php code after submiting a form.
Can anyone explain it to me ?
Thank you in advance !
Thank you !
There was some discussion in the past of an on_form_submit event being added (I don't know if it has been). If so, you task is made easier because you can simply add an event handler rather than needing to override the controller file.
You may find that one of the more specialised form block addons already has such an event or another means of adding your code to the form submission.
Of course, the email address is saved in the database.
So most of what you want is in the block. What you would need to do in a block controller override is to change it to send an email to the visitor(easy) and to attach the file to it(maybe a bit more difficult).
However, stuff like that is such a common requirement that I suspect one of the advanced form addons may already do it for you and for the cost of a few tens of $ would usually be good value compared to the time it would take you to code the override.
There are also addons for membership and for adding digital docs to eCommerce that do this sort of thing (though are obviously more expensive than a clever form addon)
Will think about it !