PHP code example of ee-objects / forms

1. Go to this page and download the library: Download ee-objects/forms 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/ */

    

ee-objects / forms example snippets



$form = new MyFormObject()
$defaults = [];
$vars = [];
$form->setData($this->settings->settings('cartthrob'));

if ($_SERVER['REQUEST_METHOD'] === 'POST') {

	$form->setData($_POST);
	$result = $form->validate($_POST);
	if ($result->isValid()) {
        //magic time
	}

    $vars['errors'] = $result;
}

$vars['sections'] = $form->generate();