Multiple Submit in a Drupal Form I want a list of the input of my saved database table with buttons to delete or view the content and want to redirect it in the submit function.

With this code snipped i get only the submitted input value of the buttons, but every time is the $form_state['values'] array filled with the 1st form values. Is that the right way or need I another solution? 

function myform_block_view($delta = '') {
    $block = array();

    global $user;
    $uid = $user-&gt;uid;
    $utime = $user-&gt;timezone;

    $query = db_select('mytable', 'm');
    $query-&gt;condition('m.uid', $uid, '=');
    $query-&gt;fields('m', array('fid', 'uid', 'name', 'created'));
    $query-&gt;range(0, 50);

    $results = $query-&gt;execute()-&gt;fetchAll();

    if($uid) {  
        switch ($delta) {
            case 'myblock':
                $block['subject'] = '&lt;none&gt;';
                $block['content'] = _block_content($results);
            break;
        };
    };  
    return $block;
}

function _block_content($items) {
    $output = array();

    foreach($items as $item =&gt; $item_value) {
        $output[$item] = drupal_get_form('mymodule_form', $item_value);
    };
    return $output;
}

function mymodule_form($form, &amp;$form_state, $i) {

    global $user;
    $uid = $user-&gt;uid;
    $utime = $user-&gt;timezone;

        $form['value-'.$i-&gt;fid] = array( //EDIT
            '#type' =&gt; 'value',
            '#value' =&gt; $i-&gt;fid,
        );
        $form['view-'.$i-&gt;fid] = array ( //EDIT
            '#type' =&gt; 'submit',
            '#value' =&gt; t('view'),
            '#name' =&gt; 'view-'.$i-&gt;fid,
        );
        $form['delete-'.$i-&gt;fid] = array ( //EDIT
            '#type' =&gt; 'submit',
            '#value' =&gt; t('delete'),
            '#name' =&gt; 'delete-'.$i-&gt;fid,
        );

    return $form;
}

function mymodule_form_submit($form, &amp;$form_state) {
   dpm($form_state);
   $form_state['rebuild'] = TRUE; //EDIT
}


The dpm output without 'form_build_id' 'form_token' 'form_id' in both,
1st example:

input =&gt;  
    view-3 =&gt; view
    value3 (NULL)

values =&gt;     
    value2
    view-2 =&gt; view
    delete-2 =&gt; delete


2nd example:

input =&gt;  
    view-3 =&gt; view
    value3 (NULL)

values =&gt;     
    value3
    view-3 =&gt; view
    delete-3 =&gt; delete
It should be because the way you're generating the form is wrong, form element should be as below:

&lt;?php
function mymodule_form($form, &amp;$form_state, $i) {
  $form['value_' . $i-&gt;fid] = array(
    '#type' =&gt; 'value',
    '#value' =&gt; $i-&gt;fid,
  );
  $form['view_' . $i-&gt;fid] = array (
    '#type' =&gt; 'submit',
    '#value' =&gt; t('view'),
    '#name' =&gt; 'view_' . $i-&gt;fid,
  );
  $form['delete_' . $i-&gt;fid] = array (
    '#type' =&gt; 'submit',
    '#value' =&gt; t('delete'),
    '#name' =&gt; 'delete_' . $i-&gt;fid,
  );

  return $form;
}
?&gt;


Each element name in $form array should be unique. Check Drupal Form API reference guide for more details. The value, view and delete doesn't contain any form element data like #type, etc. Please check the value of $form_state['values']['op'] in your form submit handler to understand which one is called.