How do you use forms to populate content type fields? Drupal 7. Custom module.
I have a content type 'RFI' with a handful of fields I created with Drupal UI. I want a user to: fill out a form &amp; click submit while drupal: saves fields to database, creates a new node of 'RFI' and populates the fields of the node with the content provided by the form's corresponding fields.

From what I understand:

Build a form with fields (taking from the 'DBTNG examples' module just for clarity):

function rfi_build_form($form, &amp;$form_state) {
$form = array();

$form['add'] = array(
'#type'  =&gt; 'fieldset',
'#title' =&gt; t('Add a person entry'),
);
$form['add']['name'] = array(
'#type'  =&gt; 'textfield',
'#title' =&gt; t('Name'),
'#size'  =&gt; 15,
);
$form['add']['surname'] = array(
'#type'  =&gt; 'textfield',
'#title' =&gt; t('Surname'),
'#size'  =&gt; 15,
);
$form['add']['age'] = array(
'#type'  =&gt; 'textfield',
'#title' =&gt; t('Age'),
'#size'  =&gt; 5,
'#description' =&gt; t("Values greater than 127 will cause an exception. Try it - it's a    great example why exception handling is needed with DTBNG."),
);
$form['add']['submit'] = array(
'#type'  =&gt; 'submit',
'#value' =&gt; t('Add'),
);
return $form;
}


Here the form fields are saved to database with database API.

function rfi_build_submit($form, &amp;$form_state) {
global $user;

// Save the submitted entry.
$entry = array(
'name'    =&gt; $form_state['values']['name'],
'surname' =&gt; $form_state['values']['surname'],
'age'     =&gt; $form_state['values']['age'],
'uid'     =&gt; $user-&gt;uid,
);
$return = dbtng_example_entry_insert($entry);
if ($return) {
drupal_set_message(t("Created entry @entry", array('@entry' =&gt; print_r($entry, TRUE))));
}
}


Now here is how I know how to create a node of RFI type. How do I take the values of the fields above [name], [surname], [age] and have them related to corresponding fields in my content type?

function rfi_build_type($form, &amp;$form_state){
$node = new stdClass();
$node-&gt;type = 'rfi';
$node-&gt;name = '';
$node-&gt;surname = '';
$node-&gt;age = '';
$node-&gt;language = 'en';
$node-&gt;uid = 1;
node_save($node);
}


I was thinking that since the fields have been saved already, that I could use a database query to get these values, but intuition tells me I'm overlooking something.

Thank you!
You seem to be going in a slightly wrong direction with this (until I'm missing or not understanding something). If your goal is to create a node based on the data users send via a custom form then it can be done in the form submit handler. Fields added via the GUI don't need separate handling. For example if you are using node_save() then adding a custom field value could look similar to this:

$node-&gt;language = LANGUAGE_NONE; // Or e.g. 'en' if locale is enabled.
$node-&gt;field_name[$node-&gt;language][0]['value'] = $form_state['values']['name'];


and with drupal_form_submit():

$new_form_state['values']['field_name'][$node-&gt;language][0]['value'] = $form_state['values']['name'];


There's a solid amount of information available about this on the web that you might want to check out for further assistance (like this, this and this).