Professional CodeIgniter

(singke) #1

Chapter 6: Creating a Dashboard


167


echo “ < p > < label for=’parent’ > Category Parent < /label > < br/ > ”;
echo form_dropdown(‘parentid’,$categories,$category[‘parentid’]) .” < /p > ”;

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

Your Edit form should look something like Figure 6 - 7.

Figure 6-7

Creating the Category Delete Function


Deleting categories in the administrative tool is very simple: You ’ re not really going to let admins delete
categories, as this could cause all sorts of problems with products that are suddenly orphaned. Instead,
you ’ re only going to allow categories to be inactivated.

Deleting categories and possibly making orphans out of products deserves a richer discussion. Most of
that discussion occurs in Chapter 7 , in which we address possible orphans. For now, the code in this
section will keep you moving down the path to your goal.
Free download pdf