I have a controller with two functions. The first sends the form data as email (with the uniform plugin) and the second creates with that info a new page. That works great.
But my problem is, that the second function should only start if the first one ended successfully. So only if all required fields are valid, the page should be created.
I think this should be solved with some basic php code. But I’m not very used to php.
Thanks for your help.
You only need to put your second function within an if-statement, something like:
//execute 2nd function
life could be so easy… Problem solved!
thank you very much, @texnixe.
That was to early…
how do i define $success? I have the uniform controller function:
$form = uniform('contact-form', [
'required' => [
'name' => '',
'_from' => 'email',
'actions' => [
'_action' => 'email',
'to' => 'email@example.com',
'sender' => 'firstname.lastname@example.org',
'subject' => 'New message from the contact form'
You can check if an action was successful by using the
successful() function: https://github.com/mzur/kirby-uniform/wiki/Functions
So that should be something like
Awesome… No its working. Thanks a lot for your effort.