I use Kirby3 and installed the uniform for Kirby3, but the message below appears and does not work. Do you happen to know why?
I made contact.php in the controllers folder and also in the templates folder.
Help me!
Thank you.
site > controllers > contact.php
<?php
use Uniform\Form;
return function ($kirby)
{
$form = new Form([
'name' => [
'rules' => ['required'],
'message' => 'Name is required',
],
'email' => [
'rules' => ['required', 'email'],
'message' => 'Email is required',
],
'phone' => [
'rules' => ['required'],
'message' => 'Phone is required',
],
'inquiring_product' => [
'message' => 'Inquiring product is required',
],
'product_use' => [
'message' => 'Product use is required',
],
'quantity' => [
'message' => 'Quantity is required',
],
'qna' => [
'message' => 'Q&A is required',
],
]);
if ($kirby->request()->is('POST')) {
$form->emailAction([
'to' => 'sonahyong@gmail.com',
'from' => 'sonahyong@gmail.com',
]);
}
return compact('form');
};
site > templates > contact.php
<form action="<?php echo $page->url() ?>" method="POST">
<input name="email" type="email" value="<?php echo $form->old('email'); ?>">
<textarea name="message"><?php echo $form->old('message'); ?></textarea>
<?php echo csrf_field(); ?>
<?php echo honeypot_field(); ?>
<input type="submit" value="Submit">
</form>
<?php if ($form->success()): ?>
Success!
<?php else: ?>
<?php snippet('uniform/errors', ['form' => $form]); ?>
<?php endif; ?>