custom form
Permalink
I have a php form to mail script I wrote and was wondering if its possible to use this in my concrete 5 design.
The part im lost on is how to add my fields for it and then how to have the submit button use my php script to send the html form to me
The part im lost on is how to add my fields for it and then how to have the submit button use my php script to send the html form to me
So how do I build the form in Concrete 5 so that when I click submit it uses the php mail script I have
The php script is only a mail handler script, the form still needs to be built in the website first but Im not sure how to do it using an external form add-on.
I looking at using the html addon now as I think that is a lot easier to do it. I will just build the form in html and then point its action to the mail handler script.
If you could explain how the other way you suggested would work that would be great.
I looking at using the html addon now as I think that is a lot easier to do it. I will just build the form in html and then point its action to the mail handler script.
If you could explain how the other way you suggested would work that would be great.
Well if you just want to run the mail script, then you can do it by copying the core form controller into root controller folder and write down the script there. If you are not sure how to do it, just follow the below steps:
1. Copy the ROOT\concrete\blocks\form\controller.php and paste it into ROOT\blocks\form\ directory.
2. Then open the ROOT\concrete\core\controllers\blocks\form.php and find the function called function action_submit_form()
3. Copy the entire function and paste it into ROOT\blocks\form\controller.php beneath
4. At the bottom section of that function, you will find the below code:
This code is for sending email after form submission. You can add your own script there.
Note: If you still cannot understand the process, then you might require a professional help.
Rony
1. Copy the ROOT\concrete\blocks\form\controller.php and paste it into ROOT\blocks\form\ directory.
2. Then open the ROOT\concrete\core\controllers\blocks\form.php and find the function called function action_submit_form()
3. Copy the entire function and paste it into ROOT\blocks\form\controller.php beneath
class FormBlockController extends Concrete5_Controller_Block_Form { //action_submit_form() function goes here... }
4. At the bottom section of that function, you will find the below code:
$mh = Loader::helper('mail'); $mh->to( $this->recipientEmail ); $mh->from( $formFormEmailAddress ); $mh->replyto( $replyToEmailAddress ); $mh->addParameter('formName', $this->surveyName); $mh->addParameter('questionSetId', $this->questionSetId); $mh->addParameter('questionAnswerPairs', $questionAnswerPairs); $mh->load('block_form_submission'); $mh->setSubject(t('%s Form Submission', $this->surveyName)); //echo $mh->body.'<br>'; @$mh->sendMail();
This code is for sending email after form submission. You can add your own script there.
Note: If you still cannot understand the process, then you might require a professional help.
Rony
Rony