Simple form example.
Simple form exampleContains text and email input elements and demonstrates form processing and validation. In this simple case none of the elements are set required, so an empty form would also be valid.
<?php
require_once '../../HtmlForm.php';
$form->addText('username', [
'label' => 'User name',
'required' => true,
]);
$form->addEmail('email', [
'label' => 'Email address',
]);
$form->process();
if ($form->validate()) {
echo('<a href="">back</a>');
echo('<pre>');
var_dump($form->getValues());
echo('</pre>');
$form->clearSession();
} else {
?>
<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="../../lib/css/depage-forms.css">
</head>
<body>
<?php echo($form); ?>
</body>
<?php
}