mfom Warning: Illegal string offset 'select' in

mfom Warning: Illegal string offset 'select' in

by Andrew C -
Number of replies: 1

Hi Everyone,

In my function to get form elements, I use:


// Selector for courses
$mform->addElement ('select', 'assignfeedbackcourse_select', get_string('unitselect','assignfeedback_course'),     $options, 'align="center"'); 
$mform->setType('assignfeedbackcourse_select', PARAM_ALPHANUMEXT);


and then later, try to save the content into a my table

        if ($feedbackcourse) {

        $feedbackcourse->courseunitcode = $data->assignfeedbackcourse_select['select'];

        return $DB->update_record('assignfeedback_course', $feedbackcourse);


and I get the warning:

mfom Warning: Illegal string offset 'select' in


var_dump from $feedbackcourse->courseunitcode is first character of e.g.(5) of expected result

var_dump from $data->assignfeedbackcourse_select['select'] is correct e.g. (5667)


I gather that this  generally means: you're trying to use a string as a full array but can't see how to fix it. Any pointers? would isset be needed?


Thanks,

Andrew


Average of ratings: -
In reply to Andrew C

Re: mfom Warning: Illegal string offset 'select' in

by Andrew C -

After a bit of testing, I found the answer. 

A typo smile

My plugin is working now.