1

I've built a form within a module using form api. Simply liek this:

function input_menu() {
  $items['request'] = array(
    'title' => 'Request',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('input_request'),
    'access callback' => TRUE,
  );
}
function input_request($form, &$form_state) {

    $form['make'] = array(
    '#title' => t('Car make'),
    '#type' => 'textfield',
    '#required' => TRUE,
    );
}

I have some specific fields that didn't allow me to use webform module. Now how can I send the results of this form to my mailbox?

Thank you!

1
function input_request($form, &$form_state) {

    $form['make'] = array(
    '#title' => t('Car make'),
    '#type' => 'textfield',
    '#required' => TRUE,
    );

return $form; //you need this here
}

On order to send it to your mailbox, you will also need a submit button and a submit handler for your form.

Read this, it has good info on how to create, validate, submit, theme drupal forms. http://drupal.org/node/751826

FOr sending email you can use the drupal_mail_send() API or drupal_mail() depending on your Drupal core

http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail/7. http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail_send/6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.