Custom form which on submit click inserts into the database I have created a custom form in my module so that when the user clicks submit, some changes are performed in the databases and other actions follow. The form is an empty form with only the submit button nothing else. When the user clicks the Submit button, a function is called to perform some tasks. However, I am getting some errors. Here's the code:

My module folder is formtest and is placed in sites/all/modules/

formtest.info

name = Test Form
description = Accept Challenge Form Submit
core = 7.x


formtest.module

function formtest_menu() {
$items['formtest'] = array(
'title' =&gt; 'Accept Challenge',
'page callback' =&gt; 'drupal_get_form',
'page arguments' =&gt; array('formtest_form'),
'access callback' =&gt; TRUE,
);
return $items;
}

function formtest_form($form,&amp;$form_state) {
  $form['button'] = array(
  '#type' =&gt; 'submit',
  '#value' =&gt; 'Accept Challenge',
  '#submit' =&gt; array('formtest_action'),
   );
  return $form;
}

function formtest_action($form,&amp;$form_state) {
  $query = db_insert('challenges')
    -&gt;fields(array(
    'cid' =&gt; '$node-&gt;nid',
    'uid' =&gt; '$user-&gt;uid'
    ))
   -&gt;execute();
}


/**
    * To display the form on a particular content type
    */

function formtest_node_view($node, $view_mode = 'full', $langcode = NULL) {
      if($view_mode == 'full') {
        if($node-&gt;type == 'challenge') {
          $node-&gt;content['my_form'] = array(
            '#markup' =&gt; drupal_get_form('formtest'),
            '#weight' =&gt; 1,
         );
     }
   }
  }


Well that's all. There's no form showing up..no error messages..nothing...I tried a var_dump() but nothing...That custom content page is displaying as it was but there seems to be no effect of this code. Would appreciate your help in any manner. Thanks
drupal_get_form doesn't return a markup as such. it returns an array of the form structure. to get the html out put you should run the drupal_render function.

something like drupal_render(drupal_get_form('formtest');