A PHP Error was encountered
Severity: Notice
Message: Undefined index: id
Filename: controllers/event.php
Line Number: 215

function addParticipant() {
        $data['event_id'] = $this->input->get('id', TRUE);
        $event_detail = $this->EventModel->getEventDetail($this->input->get('id', TRUE));
        $data['event_title'] = $event_detail[1];
        $this->loadpage($data, 'people', 'Add participants | BCIPN');
    }

Recommended Answers

All 8 Replies

the above code shows the error in the 4th line
$data['event_title'] = $event_detail[1];

I'm guessing that there was no id passed in the URL, causing the get method to throw this notice.

If id is passed inplace of 1, the above error msg gets displayed. And if i pass 1 then the error msg will be like
A PHP Error was encountered
Severity: Notice
Message: Undefined index: 1
Filename: controllers/event.php
Line Number: 215

Do a print_r($event_detail); so you can see what it contains.

I got this output
Array ( )

That means an empty array, so $event_detail[1] does not exist. You may need to do some checking to avoid the notice. It is caused by the fact that there is no event detail found for the id you passed (or id is empty too).

try this in your function.

echo '<pre>';

print_r($this->input->get(ALL));
or 
print_r($this->input->post(ALL));

die();

@szabizs

You don't need to add ALL to retrieve complete entries from those arrays, just:

print_r($this->input->get());

Same applies to post() method.

commented: thanks :) +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.