1. Go to this page and download the library: Download alexmigf/forma 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/ */
alexmigf / forma example snippets
$args = [
'title' => 'My form title', // form title (default: '')
'classes' => '', // additional CSS form classes (default: '')
'action' => '', // file to process the form data (default: '')
'method' => 'post', // the form request method (default: 'post')
'enctype' => '', // encoding type (default: 'application/x-www-form-urlencoded')
'callback' => null, // callback function to process the form data (default: null)
'nonce' => true, // nonce validation, if data is handled by this package (default: false)
'button_text' => 'Send', // submit button text (default: Send)
'redirect_uri' => '', // URL for redirection after submit (default: '')
'messages' => [ 'error' => '', 'success' => '' ], // form custom messages (default: null)
];
$forma = new Alexmigf\Forma( $id = 'new-form', $args );
function new_form_process_callback( $request ) {
// $request contains the data to be processed
// do your stuff and return bool
$response = false;
if ( ! empty( $request ) ) {
$response = $database->insert( $request );
}
return $response;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.