codeigniter_tutorial
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
CodeIgniter<br />
}<br />
}<br />
Add the following line in application/config/routes.php.<br />
$route['validation'] = 'Form';<br />
Let us execute this example by visiting the following URL in the browser. This URL may<br />
be different based on your site.<br />
http://yoursite.com/index.php/validation<br />
It will produce the following screen:<br />
Figure: Validation Form<br />
We have added a validation in the controller – Name is required field before submitting<br />
the form. So, if you click the submit button without entering anything in the name field,<br />
then you will be asked to enter the name before submitting as shown in the screen<br />
below.<br />
Figure: Form Not Validated Successfully<br />
After entering the name successfully, you will be redirected to the screen as shown<br />
below.<br />
Figure: Form Not Validated Successfully<br />
51