Update a record in custom module I've read several custom module tutorials but none seem to show how to edit a record. My module does not use node but has a custom table. So, I think I ought to be able to drupal_get_form and populate the #value with the fields. But to set up the menu to get the parameter in the URL and my page callback is not working.

Looking around I found this answer and modeled the below after it but I get a default page instead of my expected form.

$items['redashboard/project/%/edit'] = array(
  'title' =&gt; (t('Edit project')),
  'page callback' =&gt; 'drupal_get_form',
  'page arguments' =&gt; array('re_dashboard_edit_project_form', 2),
  'access callback' =&gt; TRUE,
);

function re_dashboard_edit_project_form($form, $form_state, $projectid) {
  $project = pull_project($projectid);
  $form['name'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('Research Project Name/Question'),
    '#value' =&gt; $project-&gt;projectName,
    '#required' =&gt; TRUE,
  );
  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; 'Create',
  );
  return $form;
}

function pull_project($projectid) {
  $query = db_select('Projects', 'p');
  $query-&gt;fields('p', array('ProjectID', 'residentID', 'projectName', 'projectMentor', 'projectStatus', 'citation', 'lastUpdated'));
  $query-&gt;condition('ProjectID', $projectid);
  $result = $query-&gt;execute();
  return $result-&gt;fetch();
}


So, how should I set up a page to edit this record if not this way? Or to the point how should I set up the menu so that this callback gets rendered? thx, sam
The $items['redashboard/project/%/edit'] declaration needs to be made inside of re_dashboard_menu(), and there needs to be a re_dashboard_edit_project_form_submit() function to pipe $form_state['values'] into db_update().

Other than that, it looks like it will get the job done.  You could use db_query() instead of db_select(), since it's faster, and the query conditions are static.  Also, make sure you have a way to handle db_select() not returning any results, since fetch() will return FALSE in that case.