I’m using codeigniter for a project.
The URL is segmented like this:
example.com/admin/events
example.com/admin/events/add
I have a class called Admin which has a function called events
function events($data)
{
echo $data;
}
this will echo ‘add’ for the events/add page but when I try and access the events page alone i get an error
Missing argument 1 for Admin::events()
I thought that I could make two functions, one with a variable being passed and one without but apprently php doesn’t allow that.
Fatal error: Cannot redeclare Admin::events()
How can I make this work?
Thanks.
Try that