how to add data to custom content type using node with codeing i have drupal site with custom content type called donation and i have 4 step registration form which contains the data for the custom content type,i want to add forms data in to custom content type node how can i do that i try way like this

$nid = 1;
$node = node_load($nid);
$node-&gt;donationname = '.$data1.';
$node-&gt;donationitem = '.$data2.';
node_save($node);
The proper method is 

  $body_text = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.';

  $node = new stdClass();
  $node-&gt;type = 'article';
  node_object_prepare($node);

  $node-&gt;title    = 'Node Created Programmatically on ' . date('c');
  $node-&gt;language = LANGUAGE_NONE;

  $node-&gt;body[$node-&gt;language][0]['value']   = $body_text;
  $node-&gt;body[$node-&gt;language][0]['summary'] = text_summary($body_text);
  $node-&gt;body[$node-&gt;language][0]['format']  = 'filtered_html';

  $path = 'content/my-lipsum-' . date('YmdHis');
  $node-&gt;path = array('alias' =&gt; $path);

  node_save($node);


To Add custom fields

// Let's add some CCK/Fields API field. This is pretty similar to the body example 
$node-&gt;field_custom_name[$node-&gt;language][0]['value'] = 'This is a custom field value';
// If your custom field has a format, don't forget to define it here
$node-&gt;field_custom_name[$node-&gt;language][0]['format'] = 'This is a custom field value';


How to programmatically create/manage node in drupal 7