0

I am displaying a content information page. At the end of the content displaying page i need to display a form.

How shall i do it?

What have I done?

  1. Written a menu callback in hook_menu()
  2. Written a method to collect the information
  3. Registered a theme in hook_theme()
  4. Written hook_preprocess_theme() to register variables
  5. Created a template and assign the variables

By doing all the above, I am displaying the Content Information.

What do I need to do, to display a form at the end of the content?

I have done these thing.

  1. Created a form in a function called content_form() (including logic)
  2. Wrote a submission function (content_form_submit()).

My only todo left is displaying the form at the content information page.

2
  • <?php print render(drupal_get_form('content_form')); ?> Just putting this here to get you started ... probably better ways though
    – Jukebox
    Aug 27, 2011 at 6:42
  • great jukebox.... U r right... I forget to give drupal_get_form... thanks.. Post this is as answer pleze
    – Fero
    Aug 27, 2011 at 6:48

1 Answer 1

1

The quick and dirty way to print a form defined by hook_form is to use the drupal_get_form function:

print render(drupal_get_form('content_form'));

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.