I recently upgraded to Drupal 7.17 and found that the contact form would generate the following error message:

Notice: Undefined index: copy in contact_site_form_submit() (line 155 of /var/www/html/modules/contact/contact.pages.inc).

I believe this is down to Drupal setting PHP error reporting to E_ALL and hence causing PHP notices to be shown, while the contact module generates the above PHP notice when it tests for the presence of the 'copy' field.

Not sure what the correct solution is. I turned off PHP notices. Perhaps it's better to have the contact module check the user ID before looking for the 'copy' field.

Reference: http://www.citytree.be/blog/undefined-index-quick-fix-in-drupal7-error-r...

Comments

Yeah, I had the same issue. Turns out it was because I was using a form_contact_site_form_alter hook to remove the 'Send me a copy' option on the contact form, by simply deleting this 'copy' array.

unset($form['copy']);

No good. Instead I've chosen to simply hide it.

$form['copy']['#type'] = 'hidden';

I've read before that it's a good idea to disable notices on production sites, but I'm still not sure...

$form['copy']['#type'] = 'hidden';
Thanks! It helped me too.

Status:Active» Postponed (maintainer needs more info)

I can't reproduce this on a vanilla install, so this must be some module or custom coding altering the node form and doing something wrong. @stephandale can you check if this is the case in your install, it almost certainly has to be.

@the others, it's better to use

$form['copy']['#access'] = FALSE;

Status:Postponed (maintainer needs more info)» Closed (cannot reproduce)

no further response > closing