I am using the Drupal 6 Form API to build a custom form. I am not using the Webform module or CCK. How do I assign the user's email as a default value for a form element?

I know about #default_value => but I do not know what to assign to this.

1 Answer 1


In your form function, you can add global $user; at the top. Then in your #default_value you can use $user->mail.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.