Adding PHP Scripts to C5
Permalink
I working on installing a custom form into a site. Goal is to output form results on page.
What I have done so far.
1) added the custom form to /blocks/external_form/form
2) Added to form: <form action="<?php echo $this->action('quiz_results')?>" method="post">
3)Changed the Class in the controller and gave my fuction a custom name to match the form action:
class MoneyQuizExternalFormBlockController extends BlockController {
public function action_quiz_results() {
$this->set('response', t('Thanks!'));
return true;
}
}
now here is where my php knowledge falls short.
The results are listed as such:
$innocent = 0;
if ($_POST['anxious'] == 'yes')
$innocent++;
if ($_POST['trusting'] == 'yes')
$innocent++;
if ($_POST['feels_powerless'] == 'yes')
$innocent++;
etc...
I don't know how to convert that to what c5 can read.
I think this link is what I am looking for, but unsure how to use :
http://www.concrete5.org/documentation/developers/forms/standard-wi...
Any help appreciated.
What I have done so far.
1) added the custom form to /blocks/external_form/form
2) Added to form: <form action="<?php echo $this->action('quiz_results')?>" method="post">
3)Changed the Class in the controller and gave my fuction a custom name to match the form action:
class MoneyQuizExternalFormBlockController extends BlockController {
public function action_quiz_results() {
$this->set('response', t('Thanks!'));
return true;
}
}
now here is where my php knowledge falls short.
The results are listed as such:
$innocent = 0;
if ($_POST['anxious'] == 'yes')
$innocent++;
if ($_POST['trusting'] == 'yes')
$innocent++;
if ($_POST['feels_powerless'] == 'yes')
$innocent++;
etc...
I don't know how to convert that to what c5 can read.
I think this link is what I am looking for, but unsure how to use :
http://www.concrete5.org/documentation/developers/forms/standard-wi...
Any help appreciated.