December 2013
Intermediate to advanced
306 pages
6h 26m
English
In the preceding example, we displayed errors one by one at the top of the HTML page; however, you may wish to display each individual error closer to the form element to which it refers.
We're going to amend the /path/to/codeigniter/application/views/new_record.php file.
<?php echo form_open('form/submit_form') ; ?> <?php if (validation_errors()) : ?> <h3>Whoops! There was an error:</h3> <?php endif; ?> <table border="0" > <tr> <td>First Name</td> <?php if (form_error('first_name')) : ?> <?php echo form_error('first_name') ; ?> <?php endif ; ?> <td><?php echo form_input(array('name' => 'first_name', 'id' => 'first_name', 'value' => set_value('first_name', ...Read now
Unlock full access