Professional CodeIgniter

(singke) #1

Chapter 8: Last-Minute Upgrades


246


Creating the Edit Page View


The admin_pages_edit view is identical to the admin_pages_create view except for three tiny differences.
First, it is posting to admin/pages/edit instead of admin/pages/create. Second, it contains a hidden ID
field that you ’ ll use to update the right record in the Pages table. Third, you ’ re pulling in the existing
record from the database to populate the form fields.

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

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

echo “ < p > < label for=’short’ > Keywords < /label > < br/ > ”;
$data = array(‘name’= > ’keywords’,’id’= > ’short’, ‘size’= > 40, ‘value’ = >
$page[‘keywords’]);
echo form_input($data) .” < /p > ”;

echo “ < p > < label for=’desc’ > Description < /label > < br/ > ”;

Figure 8 - 2
Free download pdf