How to use drupal_get_form outside of a menu I am trying to use the drupal_get_form funtion outside of a menu and am not having any luck finding examples of how this is done.

An overview of what I am trying to achieve is: 
1) Pass control from a script using an href html tag passing to another script that will then read what has been passed to the new script and build a form based on the action that has been passed in. I am using the drupal_get_form function just as you would any php function.
2) I am also getting a message that says drupal_get_form is an unknown function.

This script is the initial calling script that contains an html href link to the called processing script.

function view_payment_methods() {
  try {$result = db_select('tls_connect_cashier_payment_methods', 'q')
    -&gt;fields('q', array('id', 'payment_method', 'payment_desc', 'logically_deleted', 'system_or_user'))
    -&gt;orderBy('payment_desc')
    -&gt;execute();
  } catch(Exception $e) {
    watchdog_exception(
      'view_payment_methods',
      $e,
      'Select from tls_connect_cashier_payment_methods has failed.',
      null,
      'Alert'
    );

    return false;
  }
  $payment_methods = $result-&gt;fetchAll(PDO::FETCH_ASSOC);

  $col1_label           = t('Payment Method');
  $col2_label           = t('Payment Description');
  $col3_label           = t('Disabled');
  $col4_label           = t('Created By');
  $col5_label           = t('Action');
  $edit_label           = '(' . t('Edit') . ')';
  $delete_label         = '(' . t('Delete') . ')';

  $markup  = "&lt;h1&gt;" . t('Payment Methods') . "&lt;/h1&gt;";
  $markup .= "&lt;table&gt;";
  $line    = "&lt;tr&gt;";
  $line   .= "&lt;td&gt;" . $col1_label . "&lt;/td&gt;";
  $line   .= "&lt;td&gt;" . $col2_label . "&lt;/td&gt;";
  $line   .= "&lt;td&gt;" . $col3_label . "&lt;/td&gt;";
  $line   .= "&lt;td&gt;" . $col4_label . "&lt;/td&gt;";
  $line   .= "&lt;td&gt;" . $col5_label . "&lt;/td&gt;";
  $line   .= "&lt;/tr&gt;";
  $markup .= $line;
  if (isset($payment_methods[0])) {
    foreach ($payment_methods as $entry) {
      $disabled          = '';
      $created_by        = '';
      $id                = $entry['id'];
      $payment_method    = $entry['payment_method'];
      $payment_desc      = $entry['payment_desc'];
      $logically_deleted = $entry['logically_deleted'];
      $system_or_user    = $entry['system_or_user'];
      $line              = "&lt;tr&gt;";
      $line             .= "&lt;td&gt;" . t($payment_method) . "&lt;/td&gt;";
      $line             .= "&lt;td&gt;" . t($payment_desc) . "&lt;/td&gt;";
      if ($disabled == 0) {
        $disabled      = 'No';
      } else {
        $disabled      = 'Yes';
      }
      $line             .= "&lt;td&gt;" . t($disabled) . "&lt;/td&gt;";
      if ($system_or_user == 'S') {
        $created_by    = 'System';
      } else {
        $created_by    = 'User';
      }
      $line             .= "&lt;td&gt;" . t($created_by) . "&lt;/td&gt;";
      $line             .= "&lt;td&gt;&lt;a href = '/TLSConnect3App/sites/all/modules/custom/TLSConnectPackage/cashier/PaymentMethodEditDelete.php?action=edit&amp;id=" . $id . "'&gt;" . $edit_label . "&lt;/a&gt;
                        &lt;a href = '/TLSConnect3App/sites/all/modules/custom/TLSConnectPackage/cashier/PaymentMethodEditDelete.php?action=delete&amp;id=" . $id . "'&gt;" . $delete_label . "&lt;/a&gt;&lt;/td&gt;";
      $markup           .= $line;
    }
  }
  $markup .= "&lt;/table&gt;";

  return $markup;
}


This script is the called script accessed by way of the html href link for the edit link.

if (isset($_GET['action'])) {
  $id = $_GET['id'];
  switch ($_GET['action']) {
    case 'edit':
      $form_id = 'edit_form';
      return drupal_get_form($form_id);
      break;
    case 'delete':
      break;
  }
}

function edit_form($form, &amp;$form_state) {
    global $id;
    die('chuck');
    $form = array();
}
As I understand it, you want to link to a page that displays a form and accepts certain parameters that will influence the form.


  2) I am also getting a message that says drupal_get_form is an unknown function.


That is because drupal_get_form() is not known when Drupal hasn't been formally loaded (bootstrapped). When you call PaymentMethodEditDelete.php directly, then Drupal doesn't know about it, and PHP doesn't know about any Drupal API functions. In order to have all Drupal functionality available, the point of entry must be the index.php in the webroot and not a custom script somewhere.

In order to achieve what I think you want, you need to define a so called menu callback. This is simply a url that is associated to a callback function. You can find more on the menu system in the docs to hook_menu().

In order to use this menu callback with drupal_get_form you would define the menu item like this:

function mymodulde_menu() {
  $items = array();
  ...
  $items['my/custum/url/to/form'] = array(
    'title' =&gt; 'My form title',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('mymodule_custom_form_id'),
  );
  ...
  return $items;
}


This is the bare minimum to define a page that will render as a form.

Now in order to handle arguments, you can either pass them in as ordinary $_GET parameters that you can access normally inside your form builder function.

Or you alter the newly defined menu so that it will accept additional arguments and passes them into the form builder, as arguments to drupal_get_form (see Wildcards in Paths). Also have a look at this question for more information: https://drupal.org/node/2054083.

Some more reading I can recommend:


What is the basic concept behind hooks?
http://befused.com/drupal/page-request