Codeigniter CRUD app error: trying to get property of non-object |
I have put together a CRUD application with Codeigniter 3. The update form has data validation set up, through the controller:
UPDATE function: Code: public function update($customer_id) { It does go through the if, but not through the else. UPDATE form: Code: <?php echo form_open("home/update/{$customer->id}"); ?> The UPDATE model is: Code: public function getAllCustomers($customer_id) { The UPDATE view: Code: <?php echo form_open("home/update/{$customer->id}"); ?> There is this problem with editing a record, inputting invalid data, then hitting the "Save button": Code: Severity: Notice Such a problem appears only on the update form. What could be the cause of this? Thank you!
<?php echo form_open("home/update/{$customer->id}"); ?>
There's no customer object. Looks like you're using an array, so use $customer['id']
Simpler is always better
(08-22-2017, 12:36 PM)donpwinston Wrote: <?php echo form_open("home/update/{$customer->id}"); ?> As I have written above, it does go through the if, but not the else. So there can not be a problem with $customer->id.
If you read the documentation it shows the example like below:
PHP Code: if ($this->form_validation->run() == FALSE) What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |