How to use Form API and and node_submit to insert taxonomy data I have a content type with a number of text fields and a field linked to a taxonomy vocabulary with about a dozen terms.  

I have successfully developed code using the Form API to insert data from my custom form into my node using node_submit for the text fields.  A sniped of the code I use is for the text fields is:

$node-&gt;field_s_phone[$node-&gt;language][0]['value'] = $form_state['values']['phone']; 
$node-&gt;field_s_email[$node-&gt;language][0]['value'] = $form_state['values']['email'];

node_submit($node);
node_save($node);


I would like to implement a single set of checkboxes of my vocabulary terms on the custom form, then pass the values using node_submit in a similar fashion to the text fields (sort of like):

$node-&gt;field_catagories[$node-&gt;language][0]['value'] = $form_state['values']['catagories']; 


I would be grateful for any thoughts or insight.  

Thanks,
Bill
Try this, if I completely understood you, this should help.

    $i = 0;
    foreach($form_state['values']['catagories'] as $tid) {
      $node-&gt;field_catagories[$node-&gt;language][$i]['tid'] = $tid;
      $i++;
    }