Welcome Guest, Not a member yet? Register   Sign In
update from best practice
#1

[eluser]dmitri1[/eluser]
Hi,

I'm codeigniter newbie. I'm trying to create update form. It works like this (standard): then user visits page it shows values from database, then user submits form it should show values entered by user + error message. As far as i understand from tutorial i should use form helper for this, and write something like this in my view:
Code:
<input type="text" name="name" value="<?php echo set_value('name', isset($data['name'])?$data['name']:'') ?>">

$data['name'] - is value read from db. I need to use construction
Code:
isset($data['name'])?$data['name']:''
because if form is rendered after user submit, then we don't read data from database and variable $data is not defined. On my mind it is annoying to write something like this each time.
So my question is: is there better solution for views that contain update/edit forms? I'm sure there should be nice solution, but unfortunately all tutorials and examples i've found were about add/create forms. What good/standard practice for this?
--
Thanks, Dmitri


Messages In This Thread
update from best practice - by El Forum - 03-04-2012, 09:49 AM
update from best practice - by El Forum - 03-04-2012, 11:54 AM
update from best practice - by El Forum - 03-04-2012, 09:05 PM
update from best practice - by El Forum - 03-06-2012, 02:04 AM
update from best practice - by El Forum - 03-08-2012, 02:29 AM
update from best practice - by El Forum - 03-08-2012, 06:37 AM
update from best practice - by El Forum - 03-08-2012, 08:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB