How to insert textfield in the table and submit button under the table I want to create receive item from my purchase order node.
I have to create a table and displayed all data from node.
In last column of table I need to add a textfield and a submit button under the table.



I have read a lot of reference, but still getting error.
I hope somebody help to solve my problem.

by this code i want to create a form in table 


function wespi_po_page(){
    $nid =arg(1);
    $form = array();
    $items = db_query('Select
                          Count(field_data_field_item.delta) As items
                        From
                          node Inner Join
                          field_data_field_item On node.nid = field_data_field_item.entity_id
                        Where
                          node.nid = :nid',array(':nid'=>$nid)
                    )->fetchField();
    drupal_set_message('Items counted : ' . $items);


$header = array(
    array('data' => 'Title', 'field' => 'title'),
    array('data' => 'On order', 'field' => 'on_order'),
    array('data' => 'On received', 'field' => 'on_received'),
    array('data' => 'Receive', 'field' => 'receive'),
    );

    $result = db_query ('
                        Select
                          field_data_field_item.field_item_nid As nid,
                          node.title As title,
                          field_data_field_on_order.field_on_order_value As on_order,
                          field_data_field_on_received.field_on_received_value As on_received
                        From
                          field_data_field_item Left Join
                          field_data_field_on_received On field_data_field_item.entity_id =
                            field_data_field_on_received.entity_id And field_data_field_item.delta =
                            field_data_field_on_received.delta Left Join
                          field_data_field_on_order On field_data_field_item.entity_id =
                            field_data_field_on_order.entity_id And field_data_field_item.delta =
                            field_data_field_on_order.delta Inner Join
                          node On field_data_field_item.field_item_nid = node.nid
                        Where
                          field_data_field_item.entity_id = :nid
                        Group By
                          field_data_field_item.field_item_nid', array(':nid' => $nid)
                );
    $rows = array();   
    foreach ($result as $data) {
        $rows[] = array(
                    'data' => array(
                          l($data->title, 'node/'. $data->nid),
                          $data->on_order,
                          $data->on_received,
                          //$data->status
                    )
        );
    }
    $output = theme('table',
                            array(
                                'header' => $header,
                                'rows'=>$rows,
                                'sticky' => TRUE,
                            )
        );
    return $output;
}

function wespi_po_theme($existing, $type, $theme, $path) {
  return array(
    'wespi_po_table' => array(
      'render element' => 'element'
    ),
  );
}

function wespi_po_tab_page_form_submit(){
    drupal_set_message($items . ' Items received');
}
implements hook_form in your module and fetch any data you want from database as well as add textfield.
After completion of all form items you can theme it as using 

$output = theme('table', array( 'header' =&gt; $header,  'rows' =&gt; $rows));


in your page callback function.
for more information you can check form api in drupal.org.