PHP code example of mzur / kirby-form

1. Go to this page and download the library: Download mzur/kirby-form library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mzur / kirby-form example snippets


$form = new Form([
    'name' => [
        'rules'     => ['ne' => [],
]);

if ($form->validates()) {
    // Validation passed
    // Do something with the data
}

// site/templates/my-page.php

 snippet('header') 

// site/snippets/form-errors.php

 if (count($form->errors()) > 0): 

// site/controllers/my-page.php

use Jevets\Kirby\Form;

return function ($kirby) {

    // Initialize the Form
    $form = new Form([
        'name' => [
            'rules'     => [' ($form->validates()) {
            // Show a thanks page
        } else {
            // Redirect back to the GET form
            go('/my-page');
        }
    }

    return compact('form');
};