Skip to content

Instantly share code, notes, and snippets.

Created Sep 27, 2021
What would you like to do?
Standalone Nette Forms example [en]
if (@!include __DIR__ . '/../vendor/autoload.php') {
die('Install packages using `composer require nette/forms`');
use Nette\Forms\Form;
$form = new Form;
$form->addText('name', 'Name:')
$form->addPassword('password', 'Password:')
$form->addSubmit('send', 'Register');
if ($form->isSuccess()) {
echo 'The form has been correctly completed and submitted';
$data = $form->getValues();
// $data->name contains the name
// $data->password contains the password
// process the data and redirect to another page
echo '
<!doctype html>
<meta charset="utf-8">
<script src=""></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment