Last updated April 21, 2016. Created on November 15, 2005.
Edited by hansfn, CZ, axel.rutz, webchick. Log in to edit this page.

For an interactive, data-driven website such as one built with Drupal, collecting and processing user submitted data will be exceptionally important. Most of this data can be captured using a web based form, i.e. a HTML structure with textfields and widgets for selecting different options.

Getting a form on to a webpage is easy, getting the user's responses is easy too, getting them securely is much, much harder. Drupal provides a standard, easy to use, easy to extend and secure way of adding forms to your Drupal website: Form API or FAPI for short.

This section of the handbook describes the different versions of FAPI and the different things that you can do using it (and what you can't do...yet!)

Also see:

Looking for support? Visit the forums, or join #drupal-support in IRC.


bdalhatu’s picture

I have read the topic' form Api' from different documents on the Web. Up to now i have found everything very confusing.
Is there a way to ilustrate more practically howto work with drupal Api. In particular how to generate a simple form . My background is that I have been able to develop simple php database applications which always run successfully. I find it increasingly difficult to do same with drupal. Please guide me

Thank you

Ashlar’s picture

Drupal documentation is often fragmented and very behind the times. Much of the documentation that does exist addresses V6 which is similar, but not the same in structure. In addition, comments in the documentation are not monitored and usually not responded to (I was cruising through and found your recent comment by chance. Like you, I found it very hard to follow documentation at this site, although the API for functions is all there. Here is what I recommend:

First, get the book "The Definitive Guide to Drupal 7" published by Apress. its a very good examination of Drupal and includes lots of references for more info. I also recommend "Drupal Building Blocks" by Earl and Lynette Miles to get a handle on what Views and Panels are doing (Very important modules). I recommend checking out a question site with some very good answers at both the user and programming levels. Finally, check out the #Drupal-support channel on IRC.

shunting’s picture

See here.

Not sure why this isn't coming up in Google.

AntonLargiader’s picture

I read that; it's useless for me. It's a bunch of code snippets for one small part of forms processing, not any kind of useful tutorial.

I have a form that works well outside Drupal but breaks (doesn't return to the page properly) in Drupal. I have yet to actually find a tutorial showing how to implement a form (from start to finish, form to processor to result page) with Drupal 7 FAPI.

I think there are plenty of posts here written for people who already understand the subject, but very few that actually explain things to those who don't.

seppelM’s picture

Since!topics!forms_api_reference.h... is no longer accessible, where's the replacement for it?

manish_mics’s picture, please check here for Drupal 8 Form API