How to add an edit and delete button to a custom html table?
$query = db_select('mytable', 'n')
    -&gt;fields('n')
    -&gt;execute();
  $rows = array();
  while($data = $query-&gt;fetchAssoc()){
  // Fill the table rows
    $data['operation'] = l(t('Delete'), 'admin/mid-modules/component/' . $data['cid'] . '/delete');
    $data['operation'] .= "|";
    $data['operation'] .= l(t('Edit'), 'admin/mid-modules/component/' . $data['cid'] . '/edit');
    $rows[] = array('data' =&gt; $data, 'style' =&gt; 'word-break:break-all;',);
  }

  // Prepare table header
  $header = array( t('S.No'),t('Component Name'));
  // Output of table with the paging
  $output = theme_table(
    array(
      "header" =&gt; $header,
      "rows" =&gt; $rows,
      "attributes" =&gt; array(),
      "sticky" =&gt; true, // Table header will be sticky
      "caption" =&gt; "",
      "colgroups" =&gt; array(),
      "empty" =&gt; t("Table has no row!") // The message to be displayed if table is empty
    )
  );
  return $output;
//following menus that delete or edit your selected content

    $items['admin/mid-modules/component/%ctools_js'] = array(
    'page callback' =&gt; 'popup_callback',
    'page arguments' =&gt; array(3),
    'access callback' =&gt; TRUE,
    'type' =&gt; MENU_CALLBACK,
    'file' =&gt; 'popup.inc'
  );
 $items['admin/mid-modules/component/%/delete'] = array(
    'title' =&gt; 'Delete Component item',
    'page callback' =&gt; 'delete_me',
    'page arguments' =&gt; array('delete_component_record_comfirm',3),
    'access arguments' =&gt; array('administer users'),
    'type' =&gt; MENU_CALLBACK,
    'file'=&gt;'delete_record.inc',
  ); 

/**
 * Delete  Record Confirmation ------------------------------------
 */
function delete_component_record_comfirm($form, &amp;$form_state, $cid){
   // print_r($cid);exit;
 $form['delete'] = array(
    '#type' =&gt; 'value',
    '#value' =&gt; $cid,
  );
  return confirm_form(
    $form,
    t('Are you sure you want to delete this?'),
    'admin/mid-modules/component/'. $data['cid'],
    t('This action cannot be undone.'),
    t('Delete'),
    t('Cancel')
  );
}
/**
 * Delete Survey Record Function
 */
function delete_component_record_comfirm_submit($form, &amp;$form_state) { 
  $record = $form_state['values']['delete'];
  if ($record ) {
    $num_deleted = db_delete('mid_components')
      -&gt;condition('cid', $record )
      -&gt;execute();
    drupal_set_message('The record has been deleted!');
  }
  $form_state['redirect'] = "admin/mid-modules/component";
}