Associating a user with a particular form submit/click In my web site i have created a custom content type Challenge which contains a list of tasks that the user has to do. I have created the custom content type from the CMS itself through admin/structure/content type. I have created a custom form, , and when the user clicks submit i have made a query which insures that the node id of that challenge and the user id is associated in a Challenge table (the code is below). It works fine. Now i need to create a view which shows the challenges accepted by the user, i.e., when the user logs in and clicks on a tab(i am using quicktab) then a view appears which shows the challenges undertaken by the user. Here my code for the query:

function my_module_menu() {
  $items = array();
  $items['my_module/form'] = array(
    'title' =&gt; t('My form'),
    'page callback' =&gt; 'my_module_form',
    'access arguments' =&gt; array('access content'),
    'description' =&gt; t('My form'),
    'type' =&gt; MENU_CALLBACK,
  );
  return $items;
}

function my_module_my_form($form_state) {

  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; 'Accept Challenge',
    '#submit' =&gt; array('my_module_action'),
    );

  return $form;
}

function my_module_action($form, &amp;$form_state) {

 if ($node = menu_get_object()) {
  // Get the nid
   $nid = $node-&gt;nid;
    }
 global $user;
 if ( $user-&gt;uid ) {
 $query = db_insert('challenges')
    -&gt;fields(array(
    'cid' =&gt;$node-&gt;nid,
    'uid' =&gt; $user-&gt;uid
    ))
    -&gt;execute();
}


Well, thats it then. Now how do i create a view to show a user their accepted challenge.

Thanks
For node you should load challenges data in your custom module, using next: hook_node_load and/or showing next: hook_node_view. See examples module for it: nodeapi_example. 
For Views you should define connection with your custom table and node, there nice example for it.
For Views also you can use Data module.