0

I have 2 webforms set up, one form collects the user email address and emails the user some info, the second form collects their email address again and needs to select the previous form's submitted data from the database and forward this onto a selected user.

Is there an efficient method for selecting webform data filtered by a field, rather than nid or sid, (in my case it would be an email address)?

1

The $filters parameter on webform_get_submissions() can be used for field filtering. The function's code loops over the filters and adds them as conditions.

foreach ($filters as $column => $value) {
  $pager_query->condition($column, $value);
}

So something like:

$old_form_submission = webform_get_submissions(array('email_field_name'=> $provided_email));
  • Thank you for answering, but it doesn't work, returns an error 'Column not found: 1054 Unknown column'. So it doesn't look like it works on data fields. – user61102 May 9 '16 at 20:19
  • Did you check the field name? Obviously the one I provided is a junk example. Check the field name against the database and make sure it's right. – acrosman May 9 '16 at 20:46
  • Is that the 'Field Key'? – user61102 May 9 '16 at 20:57
  • The info I need to filter on is in the 'data' column of the 'webform_submitted_data' table, there are no columns in the database that are named after form fields, maybe I'm missing something? – user61102 May 9 '16 at 20:59
0

I know that in Webform 4.x, you can select a certain array of fields to print to download by navigating to your webform, and then going to the download area. I use this to grab email address's for everyone who has opted in for newsletters, so that I can compile a list of first names, last names, and email address's to import into Mail Chimp.

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.