Code Igniter Passing Variable to Controller Using URL Error
codeigniter
Solution
In your controller, do this:
function cake($var = null) {
// your other code here
}
When `$var` isn't present in the URL, it will be set to `null` and you'll receive no error.
Problem
I am creatting a Code Igniter project in which I want to pass a variable through the URL like a get statement, like this: url: /site/cake/1 controller function: cake($var) but when the variable is left blank, I receive an error, how can I get code igniter, to ignore this?