Insert row into database table from form input (uniform)

hi there!

i would like to insert a row into a table of my database with the inputs of a form and the logged in user’s email but i only get a white screen after i click the submit button. does someone see the mistake in my controller?

<?php

use Uniform\Form;

return function ($kirby, $page, $pages) {

$form = new Form([
...
]);

if ($kirby->request()->is(‘POST’)) {
$data = [
...
];

try {
  $bool = Db::insert('table', [
    'email'    => $kirby->user()->email(),
    'url'    => $page->url(),
    'column' => $data['input']
  ]);
  dump($bool);
  go('/');
} catch (Exception $e) {
  $error = true;
}
}

(the topic before contained unnecessary code, so i deleted it. sorry for the spam!)

if someone has some experience with connecting kirby and databases, that would be great!

sigi

You don’t have to delete posts but can edit them.

Is debugging enabled?

There’s a closing curly brace missing, but probably due to your shortened code…

there was some code that i did not want the public to see, so i acted a bit quick there…

yes, debugging is on, and yes, that is due to my shortened code. i am sorry i will edit that now.

i just found out what the issue was:
i forgot to give the table columns a standard value so when i submitted the form with one empty input field, it did not work.

@texnixe thank you again for the quick answer!