Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $form_data = array();
- $form_data['values']['firstname'] = $user->field_civilite['und'][0]['tid'];
- $form_data['values']['lastname'] = $user->field_prenom['und'][0]['value'];
- $form_data['values']['mail'] = $user->field_nom['und'][0]['value'];
- webform_client_form_submit(226, $form_data);
- $node = node_load($nid); //nid is the node id of your webform
- global $user;
- //the values to save
- $data = array(
- 1 => array('value' => array($first_value)),
- 2 => array('value' => array($second_value)),
- );
- $submission = (object) array(
- 'nid' => $nid,
- 'uid' => $user->uid,
- 'submitted' => REQUEST_TIME,
- 'remote_addr' => ip_address(),
- 'is_draft' => FALSE,
- 'data' => $data,
- );
- module_load_include('inc', 'webform', 'includes/webform.submissions');
- webform_submission_insert($node, $submission);
- webform_submission_send_mail($node, $submission);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement