Note that there are some explanatory texts on larger screens.

plurals
  1. PODrupal 6 pulling data from checkbox array
    text
    copied!<p>I am currently working on a custom form module in Drupal 6. In this form I am using a checkboxes field with about 10 different options. The problem I seem to be having is that the only output I get from the checkboxes is "array". I have spent a couple hours googling like a mad man, and have found numerous tutorials on how to create checkboxes but none really cover what to do with the data once it is entered.</p> <p>Here is the checkbox code:</p> <pre><code>$form['message_box']['products'] = array( '#type' =&gt; 'checkboxes', '#title' =&gt; t('What services are you interested in ?'), '#options' =&gt; array( 'home_and_auto' =&gt; t('Home &amp; Auto Insurance'), 'auto' =&gt; t('Auto Insurance'), 'home' =&gt; t('Home Insurance'), 'other' =&gt; t('Other Personal Insurance'), 'business' =&gt; t('Business Insurance'), 'farm' =&gt; t('Farm Insurance'), 'life' =&gt; t('Life Insurance'), 'health' =&gt; t('Health Insurance'), 'rv' =&gt; t('Recreational Vehicle Insurance'), 'financial' =&gt; t('Financial Services'), ), '#weight' =&gt; 39 ); </code></pre> <p>I've set a variable for the array </p> <pre><code>$products = $form_state['values']['products']; </code></pre> <p>And the code for the email body: </p> <pre><code> $body = 'New quote request from '.$sender.'&lt;br&gt;&lt;br&gt;Email Address :'.$valid_email.'&lt;br&gt;'.'Phone No :'.$phone.'&lt;br&gt;&lt;br&gt;'.'Address :&lt;br&gt;'.$street.'&lt;br&gt;'.$city.', '.$state.'&lt;br&gt;'.$zip.'&lt;br&gt;&lt;br&gt;Interested in the following products&lt;br&gt;'.$products.'&lt;br&gt;&lt;br&gt;'.$emessage; </code></pre> <p>Thanks for whatever assistance you can provide.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload