Welcome Guest, Not a member yet? Register   Sign In
edit and add logic
#3

(06-23-2016, 04:48 AM)JayAdra Wrote: Read. The. Docs.

http://www.codeigniter.com/userguide3/li...g-the-form

Agreed he should read the docs, but that link does not help in this case. He wants to populate fields with values from a DB record.

@davy_yg
First: Don't use tables for layout. Use divs

Now as for code, your question has little to do with CI and more with PHP in general.
Your page will need a flag telling it if it is in ADD mode OR EDIT mode. In ADD mode you could set an empty array with key names that match your field names. Use this array in your view setting each value.
PHP Code:
value="<?php echo $record['page_name']; ?>" 

In EDIT mode you will fill the empty array with the correct values, thus your form will have the values set for editing
Reply


Messages In This Thread
edit and add logic - by davy_yg - 06-23-2016, 04:42 AM
RE: edit and add logic - by JayAdra - 06-23-2016, 04:48 AM
RE: edit and add logic - by Martin7483 - 06-23-2016, 05:59 AM
RE: edit and add logic - by davy_yg - 06-23-2016, 06:36 AM
RE: edit and add logic - by InsiteFX - 06-23-2016, 11:20 AM
RE: edit and add logic - by ivantcholakov - 06-23-2016, 02:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB