Programmatically adding fields to node submission form I need to add fields to a node creation/editing form programmatically. More specifically, I need to take already-generated form elements from another form and insert them into the node submission form.

That part isn't what's hanging me up though. My problem is that I can't figure out how to make the database hang onto the values submitted via the new field.

For example, the following code (copypasta'd directly from the API Quickstart page) creates a form element inside the existing node form just fine, but when I enter a value and submit the form, the value is not stored.

function [mymodule]_form_alter(&amp;$form, &amp;$form_state, $form_id) {
    $form['foo'] = array(
      '#type' =&gt; 'textfield',
      '#title' =&gt; t('bar'),
      '#default_value' =&gt; t('foo'),
      '#size' =&gt; 60,
      '#maxlength' =&gt; 64,
      '#description' =&gt; t('baz'),
    );
}


How do I alter an existing form in such a way that the submitted values 'take,' so to speak?
Add something like this to your hook_form_alter().

$form['#submit'] += array('mymodule_another_submit_handler');


Create that function and save your values from $form_state['values'].

function mymodule_another_submit_handler(&amp;$form, &amp;$form_state) {}


Where are they supposed to go? You might try to fire the submit handler of the other form so you wouldn't have to write so much code.