Multiple submit buttons: Which one was pressed?
Data about clicked button is stored in $form_state['triggering_element']. You can get the node ID by looking at $form_state['triggering_element']['#parents']. In your case the node ID would be the second item in the parents array. Please note that the name attribute of the field definition needs to be defined and unique. Otherwise the triggering element will point to the last submit button on the form. I would alter your code as follows:

$form['f'] = array();
foreach ($rows as $row) {
  $form['f'][$row['nid']] = array();
  $form['f'][$row['nid']]['nid'] = array(
    '#markup' =&gt; $row['nid'],
  );
  $form['f'][$row['nid']]['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('sumbit'),
    '#name' =&gt; 'submit-' . $row['nid'],
    '#submit' =&gt;  array('f_submit'),
  );
}


Good way to view $form_state is to install the Devel module (for krumo()) and then putting krumo($form_state);drupal_exit(); to top of the submit handler. This will print out a nice structured tree of data.