[eluser]atebit[/eluser]
I am attempting to combine my add and edit views and have some questions regarding best approach. (The wiki has some info, but is for older version of CI). I am currently using 1.7.3.
Basic setup... when I call edit, I pass a $data array to populate the fields:
Code:
<?=form_input('email', $user->email)?>
Obviously with add, $data will not exist.
Code:
<?=form_input('email', set_value('email'))?>
The quick and dirty (wrong) way would be...
Code:
<? if(isset($user)) ?>
<?=form_input('email', $user->email)?>
<? else ?>
<?=form_input('email', set_value('email'))?>
<? endif ?>
Attempting to keep up with DRY philosophy, what is best approach?