form api
HowTo: Add a freetagging form to a node display (Drupal 5)
Posted April 23rd, 2008 by JodyThis has been added to the Drupal 5 PHP Snippet section of the Drupal Handbook
I needed to make a little freetagging form to allow users to tag content as they view it - here's how I did it:
Set up a freetagging vocabulary using taxonomy.module and assign it to your content type as usual. Note the vid (vocabulary id) of your freetagging vocabulary (you can find it in the URL when editing the vocabulary). In a custom module, create a new form like so:
<?php
// form for adding tags to nodes
function MY_CUSTOM_MODULE_tag_form($nid = 0) {
$form = array();
$form['nid'] = array(
'#type' => 'hidden',
'#value' => $nid,
);
$form['tag'] = array(
'#type' => 'textfield',
'#title' => 'add tag',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('+'),
);
return $form;
}
?>


