Have you ever used a function call in `empty()` for an `if` condition to perform some checking? Then you might come up with an PHP fatal error saying Can’t use method return value in write context. I am explaining here why did the error come and 2 ways to write them correctly.
I have few sites of clients running with Codeigniter and are hosted by different hosts including Godaddy, Host Gator and others. With few hosts I had problems with working of CI, whenever I tried to access the website, I just used to get a text in browser saying ‘No input file specified’ and no html as expected except this text.
While developing large applications, we might wish to organize Controllers into Sub-Directories or Subfolders for our convenient. This article will guide you to smoothly organize the controllers in sub-directory or folder. I’m using Codeigniter version 3.0 here.
Are you facing any notice saying Undefined property: Home::$db or something like this in your Codeigniter application? The reason behind the error Undefined property $db in Codeigniter arises because you didn’t load database library in your controller/method to use any function of it.
Sometimes it’s required to place two forms on one page in codeigniter like displaying login form and register form on same page. Although the views may be different but you can face conflict while displaying validation errors if the form actions are not separate (aren’t calling different methods in controller). Here is a workaround to validate one form at a time while placing multiple forms on one page in codeigniter.
The set_value(‘field name’) function in codeigniter allows us to retain the value of input field in form during form submission but it’s not applicable to keep checkbox checked if it was checked while the form was submitted or during postback submit refresh. Here to keep checkbox checked after form submit in Codeigniter, the set_checkbox() function plays the role.
Checkbox validation in Codeigniter form is not as straight as validating other input types. As usually we need to check if a checkbox is checked or unchecked during form submission likewise if user accepted or not ‘TOS (Terms of Services)’ through checkbox. So I have provided a form validation rule to validate checkbox as ‘required’ rule can’t do the task.