Form API-built form only emails Array, not the form results

Solutions

This line is probably the problem:

$params['message'][] .= ...

If $params['message'] is a string then you want to be concatenating directly to that string like this:

$params['message'] .= ...

When you put empty square brackets [] on the end of a variable PHP treats that variable as an array and essentially pushes whatever's after the = sign on to the array.

The way you're doing it (with a string concatenation of .=) I'm not actually sure what the logic flow would be but it wouldn't be pretty...I'm surprised you don't get a fatal error for this :)

Tags: Drupal 6 / Forms / Emails

Similar questions

webform "Load a pre-built option list" not shown
I use the webform module to build a form. I'd like to fill a select with values coming from a database. I use the hook Here is some sample code: /** * Implementation of hook_webform_select_options_info(). * See webform/webform_hooks.php for further information on this hook in the Webform API. */ function custom_webform_pre_build_list_webform_select...
Why does my D7 User view only display 6 results in Block View, but all results in Page view?
I have a simple D7 view that lists all usernames and a couple of associated fields (business name, contact name) in table format. It has exposed filters on those fields, and about 200 users to list, sorted by creation date. In Page View, this works perfectly as expected : I can page through a list of active users, and filter them. However, when I t...
No Emails sent on User Creation in D8 through Rest API
I'm working in Drupal 8.2.4 currently and building a headless webapp using Rest Web Services module for the endpoints I need. I'm using the endpoint /entity/user to create users, however the default welcome emails are not getting sent out by Drupal when I create the users. I do have the emails set up to be sent properly and I know this because if I...
How i can popuplate user's facebook data into my built-in drupal register form?
How can I populate an authorized user's Facebook data into my Drupal registration form? Note: user is authorized from my Facebook application and allowed my Facebook app to access his data. Update: I am using Drupal for Facebook, and to populate the user info I am implementing fb_form_alter inside fb.module. My code is I put the above code after th...
How can I output a text string when my dynamically built form is empty?
I have a form that is dynamically built. It renders a list of check boxes, but sometimes there are none to render - it is empty. In this circumstance, instead of the forms #titles with nothing below them being rendered, I'd like to output t('None'). For the type #tableselect the option seems to exist: #empty, but not for checkboxes or any other typ...
Obtaining all values from a built form
I'm building a form and setting values via where I set the passed key1 as the default values for the associated fields : in My\Module\buildForm, you would find This takes place in a controller not directly related to the form and I'd like to retrieve all values set, either as defaults or as parameters of the page, something like ['key1' => 'x'] ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.