I need to submit data to a webform.

I receive data from POST submission from mobile application ("webservices").

So I try something like :

$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);

But this is don't do anything.

Someone have any idea to do that?

  • Just to clarify, are you using Services? – Chapabu Nov 30 '12 at 10:06
  • yes i'm using it – Alexis Montoro Dec 3 '12 at 11:08
  • See the solution here with a particular description how to get data into submission fields. – Peter Lozovitskiy Mar 21 '19 at 4:24

webform can be programatically save, as shown in below example,

  $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);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.