<?php /** * Nette\Forms example 8 * * - Cross-Site Request Forgery (CSRF) form protection */ require '../../Nette/loader.php'; /*use Nette\Forms\Form;*/ /*use Nette\Debug;*/ Debug::enable(); $form = new Form(); $form->addText('text', 'Any text:'); $form->addProtection('Security token did not match. Possible CSRF attack.', 3); $form->addSubmit('submit1', 'Send'); // Step 2: Check if form was submitted? if ($form->isSubmitted()) { // Step 2c: Check if form is valid if ($form->isValid()) { echo '<h2>Form was submitted and successfully validated</h2>'; $values = $form->getValues(); Debug::dump($values); // this is the end, my friend :-) if (empty($disableExit)) { exit; } } } // Step 3: Render form ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">