Edit db record - Review code |
[eluser]weetstraw[/eluser]
How does this look? This code generates the form list, fills the fields with the db content and then updates. Am I missing anything? model Code: /* Get Item */ controller Code: /* Edit Record */
[eluser]pistolPete[/eluser]
Some suggestions: function getItem If there is no entry for $id, nothing is returned. I'd suggest returning FALSE and checking that value in the controller. function updateRecord Don't use the whole $_POST array, it could break your query if there are values submitted via POST not contained in the database structure. Rather use the Input Class The model should not redirect, leave that to the controller. I'd put the form related functions (form_input, form_textarea) into the view. Don't you validate the entered values? You should consider using the Form Validation Class. |
Welcome Guest, Not a member yet? Register Sign In |