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.



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.

| improve this answer | |
  • 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 Apr 18 '15 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 Apr 19 '15 at 20:21

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.