Form is not being rendered in template file I have tried drupal_render,drupal_get_form etc for rendering the form,but the form is not being rendered. Is there any error in code or else what else should i add to the code so that it works.

function questionnaire_template_form($form, &amp;$form_state, $question) {
 print_r("in template function");

 $form_build = unserialize($question-&gt;criteria_data);

 foreach ($form_build as $key =&gt; $value) {

  $options = ($form_build[$key]['1']);
   $list = explode("\n", $options);

   $list = array_map('trim', $list);

   $list = array_filter($list, 'strlen');

   foreach ($list as $key =&gt; $value) {

    $new = explode('|',$value);
    $new_key = reset($new);
    $new_value = end($new);
    $new_list = array($new_key =&gt; $new_value);
    dsm($new_list);
   }
dsm('next');

   $fb = explode("_",$key);
   $type =reset($fb);

  if($type == 'radio') {

    if($form_build[$key]['0']) {
      $form['radio_form'] = array(
        '#type' =&gt; 'radios',
        '#options' =&gt; $list,
      );
    }
  }
   elseif($type == 'checkbox') {
    if($form_build[$key]['0']) {
     $form['checkbox_form'] = array(
       '#type' =&gt; 'checkboxes',
       '#options' =&gt; $list,
      );
    }
   }
   elseif($type == 'selectlist') {
    if($form_build[$key]['0']) {
      $form['selectlist_form'] = array(
        '#type' =&gt; 'select',
        '#options' =&gt; $list,
        );
   }
  }

}
return $form;
}


Above code is my form.

&lt;div&gt;
&lt;?php
//print_r($variables['entity']-&gt;qid);?&gt;&lt;/br&gt;&lt;?php
print_r($variables['entity']-&gt;title);?&gt;&lt;/br&gt;&lt;?php
print_r($variables['entity']-&gt;text);?&gt;&lt;/br&gt;&lt;?php
?&gt;&lt;/br&gt;&lt;?php
?&gt;&lt;/br&gt;&lt;?php
if($variables['entity']-&gt;criteria) {
  ?&gt;&lt;br/&gt;&lt;?php
  $form_template = drupal_get_form('questionnaire_template_form' , $variables['entity']);
  print(drupal_render($form_template));

}
?&gt;&lt;/br&gt;&lt;?php

print_r(l( t("Yes"), 'questionnaire/' . $variables['entity']-&gt;yes_quid));?&gt;&lt;/br&gt;&lt;?php
print_r(l( t("No"), 'questionnaire/' . $variables['entity']-&gt;no_quid));?&gt;&lt;/br&gt;&lt;?php

?&gt;
&lt;/div&gt;


And this is the template where I am rendering the form.
I am getting the form if I dsm the form
Drupal render will return the html

drupal_render(drupal_get_form('form_id'));    


you have to print the returned html as well.

print drupal_render(drupal_get_form('form_id'));


in your case 

$form_template = drupal_get_form('questionnaire_template_form' , $variables['entity']); 
drupal_render($form_template);


change it to

$form_template = drupal_get_form('questionnaire_template_form' , $variables['entity']); 
print drupal_render($form_template);