Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my Drupal 7 custom moudle, i would like to output result of form as an formatted array. Simmilar like you can print_r or printf arrays.

 $form['results'] = array(
            '#type'     => 'item',
            '#markup'   => $form_state['temporary']
)

so $form_state['temporary'] is array, but i do not want "array" text to show up but formatted array representation, whatewer is in it.

Thanks!

share|improve this question
up vote 2 down vote accepted

Just try like:

'#markup' => '<pre>'.print_r($form_state['temporary'], true).'</pre>';

you could just save the print_r() value to variable and then output that to a Div or something ...

share|improve this answer
    
Ah... of course, as simple as that, i an an blind fool... tnx :) – NenadP Jan 10 '13 at 22:40
    
@tenken, I am stuck on the part where you mention about "output that to a Div" , in my for submit I have set the results array but it does not print anywhere? – pal4life Nov 11 '14 at 3:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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