I get 'Fatal error: Cannot use string offset as an array in /home/artdept/public_html/includes/form.inc on line 976' when running this

<?php
function contact_form($form_state) {

   $form['email'] = array( 'textfield',
    '#title' => t('email address'),
    '#size' => 30,
    '#maxlength' => 64,
  );
  $form['subject'] = array(
    '#type' => 'textfield',
    '#title' => t('subject'),
    '#size' => 30,
    '#maxlength' => 64,
  );
  $form['message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message'),
    '#default_value' => '',
    '#cols' => 60,
    '#rows' => 5,
  );
  $form['submit'] = array('#type' => 'submit', '#value' => t(''));
  return $form;
};
print drupal_get_form('contact_form');

can you see the problem?
many thanks
Marcus

Comments

greylogic’s picture

   $form['email'] = array( 'textfield',
    '#title' => t('email address'),
    '#size' => 30,
    '#maxlength' => 64,
  );

should be

   $form['email'] = array(
    '#type' => 'textfield',
    '#title' => t('email address'),
    '#size' => 30,
    '#maxlength' => 64,
  );

--------------------------------------------------------------
My attempt with Drupal - Jaanlo.com

marcus7777’s picture

cool thanks greylogic

picco’s picture

in d6 my problem was that form array was not initialized $form = array();