Professional CodeIgniter, Thomas Myer
Chapter 7: Improving the Dashboard
216
Figure 7-10
If you were to load the admin/colors/index controller in your browser, you would see something
similar to Figure 7 - 10 .
There aren ' t any records in the table, but that ' s OK. You ' ll shortly be creating a view that will allow you
to create colors, and then you ' ll use the form to populate the table.
to create colors, and then you ' ll use the form to populate the table.
The admin_colors_create view is about as simple as it gets. It is just a short form that prompts the user
for a color name and status:
<
h1
>
<
?php echo $title;?
>
<
/h1
>
<
?php
echo form_open(`admin/colors/create');
echo "
<
p
>
<
label for='name'
>
Name
<
/label
>
<
br/
>
";
$data = array(`name'=
>
'name','id'=
>
'name','size'=
>
25);
echo form_input($data) ."
<
/p
>
";
echo "
<
p
>
<
label for='status'
>
Status
<
/label
>
<
br/
>
";
$options = array(`active' =
>
`active', `inactive' =
>
`inactive');
c07.indd 216
c07.indd 216
6/10/08 5:36:47 PM
6/10/08 5:36:47 PM