Drupal 7: Edit/delete is not working on the custom module I am a newbie to drupal. I am working to create a custom module in the name "course". I have read about the list of hooks to create a custom module. So, what's my problem is that i cant able to see the edit form for the module configure but i can do add management and its working fine.
I've used Existing contact modules as a reference.

Below are my code:
In course.module

function course_menu() { 
  $items['admin/structure/course'] = array(
    'title' =&gt; 'Academy\'s courses',
    'description' =&gt; 'Create a system contact form and set up categories for the form to use.',
    'page callback' =&gt; 'course_list',
    'access arguments' =&gt; array('administer contact forms'),
    'file' =&gt; 'course.admin.inc',
  );
  $items['admin/structure/course/add'] = array(
    'title' =&gt; 'Add Courses',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('course_edit_form'),
    'access arguments' =&gt; array('administer contact forms'),
    'type' =&gt; MENU_LOCAL_ACTION,
    'weight' =&gt; 1,
    'file' =&gt; 'course.admin.inc',
  );
  $items['admin/structure/course/edit/%course'] = array(
    'title' =&gt; 'Edit Courses',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('course_edit_form',4),
    'access arguments' =&gt; array('administer contact forms'),
    'file' =&gt; 'course.admin.inc',
  );

  return $items;
}


and in course.admin.inc:

function course_edit_form($form, &amp;$form_state, array $course = array()) {
  // If this is a new course, add the default values.

  $course += array(
    'name' =&gt; '', 
    'course_id' =&gt; NULL,
  );

  $form['name'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('Course Name'),
    '#maxlength' =&gt; 255,
    '#default_value' =&gt; $course['name'],
    '#description' =&gt; t("Example: 'Available Course Names'."),
    '#required' =&gt; TRUE,
  );

  $form['course_id'] = array(
    '#type' =&gt; 'value',
    '#value' =&gt; $course['course_id'],
  );
  $form['actions'] = array('#type' =&gt; 'actions');
  $form['actions']['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Save'),
  );

  return $form;
}

function course_edit_form_submit($form, &amp;$form_state) {

  if (empty($form_state['values']['course_id'])) {
        db_insert('courses') // Table name no longer needs {}
        -&gt;fields(array(
          'name' =&gt; $form_state['values']['name'],
          'course_url' =&gt; $form_state['values']['name']
        ))
        -&gt;execute();
    //drupal_write_record('courses', $form_state['values']);
  }
  else {
     db_insert('courses') // Table name no longer needs {}
        -&gt;fields(array(
          'name' =&gt; $form_state['values']['name'],
          'course_url' =&gt; $form_state['values']['name']
        ))
        -&gt;condition('course_id', $form_state['values']['course_id'])
        -&gt;execute();
    //drupal_write_record('courses', $form_state['values'], array('course_id'));
  }

  drupal_set_message(t('Course %name has been saved.', array('%name' =&gt; $form_state['values']['name'])));
  watchdog('contact', 'Course %name has been saved.', array('%course' =&gt; $form_state['values']['name']), WATCHDOG_NOTICE, l(t('Edit'), 'admin/structure/course/edit/' . $form_state['values']['course_id']));
  $form_state['redirect'] = 'admin/structure/course';
}


I can't able to find the exact problem, why add is working but not edit &amp; delete? Help me on this.

Below image tells you what exactly i am asking for(Red mark).


If anything additional needed in this please let me know.
You are using an Auto-Loader Wildcard in your menu item definition for admin/structure/course/edit/%course. This wildcard defines the prefix for the load function of your module. In your case course_load() will be called which returns a course object from a datasource.

If the function is not found it will fallback in any of your parent menu items. In your case it is admin/structure/course.

This could be an example of you load function

function course_load($course_id) 
{
    return db_query("SELECT * FROM {course} WHERE course_id = :course_id", array(
        ':course_id' =&gt; $course_id
    ))-&gt;fetchObject();
}


Your course_edit_form doesn't receive an array of courses but 1 course object as third argument.

function course_edit_form($form, &amp;$form_state, $course)
{
     // $course is here your Course object