I'm very new to craft and I'm having trouble finding an answer to my question (I've scoured the questions on here - but the only answers appear to be for plugins).
Basically, I want to submit a form to an action in a controller - which will be inside a Module.
I have this form in a template:
<form method="post" action="" accept-charset="UTF-8">
<input type="hidden" name="action" value="site/say">
<input class="btn submit" type="submit" value="submit me">
</form>
I'm trying to get it to go to this controller (which is in modules/controllers/SiteController):
<?php
namespace app\controllers;
use yii\web\Controller;
class SiteController extends Controller
{
// ...existing code...
public function actionSay($message = 'Hello')
{
die('in say action');
}
}
I'm constantly getting a 404 - I've tried different variations for the value of action, e.g. actions/site/say. Do I need to add a route somewhere like in Laravel? Really, really stuck on this, any help would be appreciated.