Professional CodeIgniter

(singke) #1

Chapter 7: Improving the Dashboard


218


Figure 7-12

The admin_colors_edit view is jus as simple as the admin_colors_create view. Don ’ t forget to pull in the
data from $color and to embed a hidden color ID field.

< h1 > < ?php echo $title;? > < /h1 >

< ?php
echo form_open(‘admin/colors/edit’);
echo “ < p > < label for=’name’ > Name < /label > < br/ > ”;
$data = array(‘name’= > ’name’,’id’= > ’name’,’size’= > 25, ‘value’= > $color[‘name’]);
echo form_input($data) .” < /p > ”;

echo “ < p > < label for=’status’ > Status < /label > < br/ > ”;
$options = array(‘active’ = > ‘active’, ‘inactive’ = > ‘inactive’);
echo form_dropdown(‘status’,$options, $color[‘status’]) .” < /p > ”;

echo form_hidden(‘id’,$color[‘id’]);
echo form_submit(‘submit’,’update color’);
echo form_close();
? >

There ’ s no need to show a screenshot of the Edit screen, as you ’ ve got the idea by now.
Free download pdf