i am having trouble storing webform component values into a custom database table, i have created a custom module to insert the data into the table but its not working and i can't figure out where my problem is can someone please help here's my code thanks
<?php
function customform_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'webform_client_form_24') {
$form['#submit'][] = 'customform_additional_insert';
if ($node = menu_get_object()) {
$form['submitted']['node_id']['#value'] =$node->nid;
$form['submitted']['amount']['#value'] = @$node->field_needed_amount['und'][0]['value'];
$form['submitted']['full_name']['#value'] = @$node->title;
$form['submitted']['image']['#value'] = @$node->field_student_photo['und'][0]['fid'];
}
}
}
function customform_additional_insert($form, &$form_state) {
$data = $form['submitted'];
// Insert a record into a 3rd-party module table when a submission is added.
db_insert('sponsorship')
->fields(array(
'n_id' => $form['submitted']['node_id']['#value'],
'user_id' => 1,
))
->execute();
}
?>