I want to post a html form into block as content and wanted to submit the form to a page. where I will need to get the form values using $_POST and do some process on it.

How can i do that without using drupal_form(), drupal_form_submit() handlers.

Any way we can achieve it.


1 Answer 1


If your goal is to just get the HTML output of an existing drupal form then this will get you there:

$form = drupal_get_form('drupal_form_id');
$form['#action'] = url('mypath');
print render($form); 

Replace 'drupal_form_id' with whatever registered Drupal form you want and url('mypath') with whatever URL you want to post to.

  • Shawn, Its not an existing drupal form, Its just normal html form designed directly in the tpl file, hence It has no drupal gen form id or other hidden form fields.
    – Govind
    Commented Apr 18, 2015 at 6:06
  • In that case, you want to use theme_render_template($template_file, $variables). It will output the HTML you want. See the docs for more info.
    – Shawn Conn
    Commented Apr 19, 2015 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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