title: Drupal 6: Creating form to create node..!
body: <p>I am creating a custom form with 4 fields &amp; I want to create a node of a particular content type, which is having some CCK fields. </p>
  
  <p>I am intended to create node pro-grammatically on submission of this form. I have plan to push default values for some fields and some fields will be mapped with this form widgets..</p>
  
  <p>Here is my code </p>
  
  <pre><code> &lt;?php
  
  require 'modules/node/node.pages.inc';
  
  /**
   * Implements hook_menu().
   */
  
  function taskform_menu() {
    $items = array();
    $items['admin/content/taskform'] = array(
      'title' =&gt; 'Add Task',
      'page callback' =&gt; 'drupal_get_form',
      'page arguments' =&gt; array('taskform_form'),
      'access arguments' =&gt; array('create create_task content'),
    ); 
    return $items;
  }
   global $user;
  
  function taskform_perm() {
    return array('Submit daily task');
  }
  
  function taskform_form(&amp;$node)
  {
  
  
    $form['date'] = array(
      '#type' =&gt; 'date', 
      '#title' =&gt; t('Date'),        
    );
  
    $form['edproject'] = array(
      '#type' =&gt; 'select', 
      '#title' =&gt; t('Project'), 
  
      '#options' =&gt; array(
        1 =&gt; 'Konnected', 
        2 =&gt; 'eLearning', 
        3 =&gt; 'Others',
      ),
      '#description' =&gt; t('Choose a project'),
    );
  
    $form['task'] = array(
      '#type' =&gt; 'textfield', 
      '#title' =&gt; t('Task'), 
      '#size' =&gt; 30,
      '#required' =&gt; TRUE,
      '#maxlength' =&gt; 30,
      '#description' =&gt; t('Enter the task'),
    );
  
    $form['remarks'] = array(
      '#type' =&gt; 'textfield', 
      '#title' =&gt; t('Remarks'), 
      '#size' =&gt; 30,
      '#description' =&gt; t('Enter remarks (If any).'),
    );
  
    $form['submit'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; t('Add Task'),
      '#submit' =&gt; array('taskform_form_submit'),
    );
    return $form;
  
  }
  
  function taskform_form_submit($form, &amp;$form_state) {
  
    $node = new stdClass();
    $node-&gt;type = 'create_task';
    $node-&gt;uid = $user-&gt;uid;
    $node-&gt;title = $form_state['values']['task'];
    $node-&gt;body = $form_state['values']['task'];
    $node-&gt;status = 1;
    $node-&gt;promote = 0;
    $node-&gt;field_assigned_uid[]['uid'] = $user-&gt;uid;
    node_object_prepare($node);
      $node = node_submit($node);
      if ($node-&gt;validated) {
          node_save($node);
      }
      else{
          t("Node not created");
      }
  
  
  }
  </code></pre>
  
  <p>Now when I am submitting this, It's creating the content type with the text-field text as title &amp; body which I am intended to do...but I want to store UID(logged in user ID) in uid column of the table node...and I have tried doing it as you can see...but still it's sending 0... 
  I need help on this...please help</p>