Hi every one

i m trying to create node with php with node_save. I have three field of taxonomy term in content type so i m not able create a node of content type with php.
This is my code.

global $user;
$tid = 3;
$tid1 = 66;
$tid2 = 940;
$term_id = 1265;
$node = new StdClass();
$node->title = 'Tips 4 Life';
$node->type = 'tips_for_life';
$node->body = 'test';
$node->field_tip_text['0']['value'] = $value['value'];
$node->status = 1;
$node->format = 1;
$node->moderate = 0;
$node->promote = 0;
$node->sticky = 0;
$node->revision = 0;
$node->name = $user->name;
$node->comment = 0;

$node->taxonomy = array($tid => $tid ,$term_id => $term_id,$tid1 => $tid1,$tid2 => $tid2);

$node = node_submit($node);
$done = node_save($node);
if($done)
{
drupal_set_message("done");
}
else {
drupal_set_message("Not done");
}

pls help me

Comments

anandselvadurai’s picture