File tree Expand file tree Collapse file tree
user_guide_src/source/tutorial Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ the slug from our title in the model. Create a new view at
3333
3434 <h2><?= esc($title) ?></h2>
3535
36+ <?= session()->getFlashdata('error') ?>
3637 <?= service('validation')->listErrors() ?>
3738
3839 <form action="/news/create" method="post">
@@ -47,10 +48,15 @@ the slug from our title in the model. Create a new view at
4748 <input type="submit" name="submit" value="Create news item" />
4849 </form>
4950
50- There are probably only two things here that look unfamiliar. The
51- ``service('validation')->listErrors() `` function is used to report
52- errors related to form validation. The ``csrf_field() `` function creates
53- a hidden input with a CSRF token that helps protect against some common attacks.
51+ There are probably only three things here that look unfamiliar.
52+
53+ The ``<?= session()->getFlashdata('error') ?> `` function is used to report
54+ errors related to CSRF protection.
55+
56+ The ``service('validation')->listErrors() `` function is used to report
57+ errors related to form validation.
58+
59+ The ``csrf_field() `` function creates a hidden input with a CSRF token that helps protect against some common attacks.
5460
5561Go back to your ``News `` controller. You're going to do two things here,
5662check whether the form was submitted and whether the submitted data
You can’t perform that action at this time.
0 commit comments