Form elements update and deletion in D7 I have made a form in D7 using form API,submitted values to that and retrieved entries from database;now what i want is to add a delete link in front of every retrieved row.My retrieval code is:  

function form_data_menu() {
$items['formdata'] = array(
'title' =&gt; 'Form Data',
'page callback' =&gt; 'form_data_form',
'access callback' =&gt; TRUE,
);
return $items;
}
function form_data_form()
{
 $results = db_query('SELECT * FROM {drupal}');
 $header = array(t('Id'),t('Name'),t('College'),t('Education'),t('Percentage'),t('Application'));
$rows = array();
foreach($results as $result){
$rows[] = array(
$result-&gt;id,
 $result-&gt;name,
 $result-&gt;college,
 $result-&gt;education,
$result-&gt;percentage,
 $result-&gt;application,
);
}
return theme('table',array('header'=&gt;$header,'rows'=&gt;$rows));
}


any help will be appreciated. Thank You!!
Yes you can easily do it in addition to this code. You need to create another url to delete a record from the database

$items['deldata'] = array(
'title' =&gt; 'Delete data',
'page callback' =&gt; 'form_delete_form',
'page arguments' =&gt;array(1),
'access callback' =&gt; TRUE,
);

function form_delete_form($arg){
$query = db_query("delete * from the 'table_name' where 'id' =$arg");
drupal_set_message("Record deleted successfully.");
drupal_goto('formdata');

}

function form_data_form()
{
  global $base_url;
 $results = db_query('SELECT * FROM {drupal}');
 $header = array(t('Id'),t('Name'),t('College'),t('Education'),t('Percentage'),t('Application'), t('Options'));
$rows = array();
foreach($results as $result){
$rows[] = array(
$result-&gt;id,
 $result-&gt;name,
 $result-&gt;college,
 $result-&gt;education,
$result-&gt;percentage,
 $result-&gt;application,
'&lt;a href='.$base_url.'/deldata/'.$result-&gt;id.'&gt;Delete&lt;/a&gt;', 
);
}
return theme('table',array('header'=&gt;$header,'rows'=&gt;$rows));
}


Hope it works for you!