0

I have a custom drupal 7 form as below

   $form['general_details'] = array(
         '#type' => 'fieldset',
         '#title' => t('General'),
         '#description' => t('General Information.'),
         '#required' => TRUE,
         );

   $form['general_details']['salutation'] = array(
         '#type' => 'select',....

I am getting an error in the line "$form['general_details']['salutation']" Error: Cannot use string offset as an array with PHP7.2

Can someone help ? Thanks in advance.

1 Answer 1

1

You must declare empty array before assign it

 $form = array();

$form['general_details'] = array(
         '#type' => 'fieldset',
         '#title' => t('General'),
         '#description' => t('General Information.'),
         '#required' => TRUE,
);

$form['general_details']['salutation'] = array(
         '#type' => 'select',....
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.