How to hide a field when its value is set to zero I want to hide a field on a node when its value is set to zero using a content type. Here is what I had done so far to achieve my goal.

function pay_nodeapi(&amp;$node, $op, $a3 = NULL, $a4 = NULL) {
  global $user;

  if ($node-&gt;type=='salary_info' &amp;&amp; $op=='presave') {
    $public_holiday = $node-&gt;field_sstru_public_holiday[0]['value']; // here I get the value that I set to 0(No) or 1(YES) using a select list. 

    if ($public_holiday == 0) {
      $nid = node_load(207919); // load node where i want to unset this field   
      unset($nid-&gt;field_pd_public_holiday[0]); // here iam wrong and confused 
    }
    else {
      drupal_set_message("HOLIDAY");
    }
  }


what should I do to unset my field?
I'm not sure why you are using presave operation. 

If you want to hide a field on node view you should use view operation.

So your code should be as the following code:

function pay_nodeapi(&amp;$node, $op, $a3 = NULL, $a4 = NULL) {   
  if ($node-&gt;type=='salary_info' &amp;&amp; $op=='view') {
    $public_holiday = $node-&gt;field_sstru_public_holiday[0]['value'];

    if ($public_holiday == 0) {
      // you don't need to load node again.
      unset($node-&gt;field_pd_public_holiday);    
    } else {
      drupal_set_message("HOLIDAY");
    }
  }
}


Edit:

If you want to hide field on another content type or node using presave operation, then you need to load node and unset field value then save node again using node_save function 

So your code should look as the following:

function pay_nodeapi(&amp;$node, $op, $a3 = NULL, $a4 = NULL) {
  global $user;

  if ($node-&gt;type=='salary_info' &amp;&amp; $op=='presave') {
    $public_holiday = $node-&gt;field_sstru_public_holiday[0]['value']; // here I get the value that I set to 0(No) or 1(YES) using a select list. 

    if ($public_holiday == 0) {
      $node = node_load(207919); // load node by nid
      unset($node-&gt;field_pd_public_holiday[0]); // unset field from node object
      node_save($node); // save node after unsetting the unwanted field value. 
    }
    else {
      drupal_set_message("HOLIDAY");
    }
  }
}