Hi all
Am new to Kirby, but using it on a clients site which I need to finish this weekend. They want some simples forms, which can’t seem to get right at all! Can someone please help as I am going mad here… I want to understand how controllers work in the whole setup. My code below:
Template (templates\testform.php)
<?php snippet('home_header') ?>
<?php snippet('testform') ?>
<?php echo $confirm; ?>
<?php snippet('home_footer') ?>
Controller (controller\testform.php)
<?php
return function($site, $pages, $page) {
$confirm = null;
if(get('submit')) {
$confirm = "adddddddddddddddsd";
} else {
$confirm = "ssss";
}
return compact('confirm');
};
Snippet: (snippets\testform.php)
<form method="post">
<table border="1" cellpadding="5" cellspacing="2">
<tr>
<td>Name</td>
<td><input name="testfield" type="text" id="testfield" /></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="submit" value="Submit"></td>
</tr>
</table>
</form>
It won’t bring back the value for $confirm, indicating the controller does’nt run? Why? Am using Kirby 2.1.0