Extract correct field names from webhook $_POST?

  • Profile Image
    DrFischer
    Asked on December 30, 2013 at 05:32 PM

    Hi,

    I created a webhook from one of my forms that triggers the page "webhook.php" on my server. This page runs a script, that collects all $_POST data, serializes it und writes the raw data into a MYSQL database (and also sends it via email to me). Everything seems to be working well, but I have problems getting the correct field names out of the raw data. The $_POST data shows field names klike "q730_osteoporosisOr", while in my jotform, the field actually is called "Osteoporosis or osteopenia". How can I get the data extracted correctly?

    Thank you

    R.

  • Profile Image
    Jeanette
    Answered on December 30, 2013 at 10:51 PM

    Actually, what you get is the ID of each field variable, which is basically identified by an HTML element

    You might need to get these ID's and put them into variables that you can further arrange into your own MYSQL database fields accordingly

    Please check this guide for further help

    http://www.jotform.com/help/126-Form-to-MySQL

  • Profile Image
    DrFischer
    Answered on December 30, 2013 at 11:58 PM

    Thank you. Yes, I know, these are the IDs, but what I want is the names of the fields. My forms may have more than 200 questions, and I am planning to enter bigger quesitonnaires with 500 questions, and I would like to send the field names with ther answers, not just the IDs, similar to the emails that I get when a form is submitted. These emails actually list all the field names long with their contents, not just the field IDs. Is there away to get that? I just do not want to create a mysql table with 500 fields, and whenever I decide to change a couple things in my form, I will have to revamp my myhsql table.

    I already tried to connect to my MYSQL database via Zapier, but the interface is just not made for forms with 40 or more fields. WHen creating a new zap, I have to select every single field manually, and the more fields are selected, the longer it takes to register them, and at some point it just doesnt work any more at all.

    Your input is much appreciated, thanks!

  • Profile Image
    EltonCris
    Answered on December 31, 2013 at 01:02 AM

    @DrFischer

    You can actually use post directly with the provided field names e.g. $_POST['q730_osteoporosisOr'], this is used for Webhook but if that's an HTTP Post data, you can use $_POST['osteoporosisOr'] without the prefix q730_

    To find out field names to be used on post data, please enable HTTP Post data on your form.

    Then enter this URL as your "Thank you" Custom URL: https://www.jotform.com/show-post-data

    Make a test submission with your form after that, it should dump the data on the thank you page along with the formatted $_POST codes.

    Let us know if I've misunderstood your question. Thanks!

  • Profile Image
    DrFischer
    Answered on December 31, 2013 at 01:21 AM

    EltonCris,

    I am not sure what you are suggesting... the $_POST codes still show the field IDs, not the field NAMES, but maybe I misunderstood. Anyway, the field $_POST['osteoporosisOr'] actually is called "osteoporosis or osteopenia" in my jotform, and my quesiton sitll remains the same: how can I get my jotform to post the field name (e.g. "osteoporosis or osteopenia") along with the answer instead of the field id (e.g. "osteoporosisOr")?

  • Profile Image
    DrFischer
    Answered on December 31, 2013 at 01:34 AM

    by "field name" I mean the actual question, e.g. if a Yes/No question in my jotform reads as "Osteoporosis or Osteopenia", and the user clicks "No" on this particular question, the jotform will post "q720_osteoporosisOr => No", while I want it to post "Osteoporosis or osteopenia => No".

  • Profile Image
    DrFischer
    Answered on December 31, 2013 at 01:44 AM

    For example, here is a "print_r" from the webhoop.php I created:

     

    q3_name3 --> Array
    q6_dateOf --> Array
    q231_sex --> Male
    q118_heightinches --> 89
    q119_weightpounds --> 210
    q5_contactNumber --> Array
    q232_maritalStatus232 --> Single
    q4_address4 --> Array
    q225_email --> www@aznd.com
    q13_emergencyContact13 --> Array
    q73_relationship --> Brother
    q74_contactNumber74 --> Array
    q629_whatIs629 --> Low Back Pain
    q724_pleaseDescribe --> 
    q633_location --> right side
    q726_doYou --> Array
    q610_doYou610 --> No
    q686_typeOf686 --> 
    q623_doYou623 --> No
    q641_pleaseList641 --> 
    q22_pleaseList22 --> none
    q628_pleaseList628 --> none
    q580_pleaseList580 --> none
    q582_pleaseList582 --> none
    q729_doYou729 --> none
    q583_pleaseList583 --> none
    q585_pleaseList --> none
    q736_areYou --> No
    q596_anxiety --> No
    q644_depression644 --> No
    q646_dementia --> No
    q645_epilepsy --> No
    q647_migraine --> No
    q672_arthritis672 --> No
    q671_backProblems671 --> No
    q670_asthma670 --> No
    q669_copd --> No
    q668_pneumonia --> No
    q667_tb --> No
    q666_chronicHeart --> No
    q665_coronaryArtery --> No
    q664_highCholesterol --> No
    q663_highBlood663 --> No
    q662_heartAttack --> No
    q661_stroke --> No
    q660_anemia660 --> No
    q659_diabetes --> No
    q658_gout658 --> No
    q657_renalStone --> No
    q656_thyroidDisease --> No
    q655_gerd --> No
    q654_ulcer --> No
    q653_bph --> No
    q652_cancer --> No
    q651_dermatitis --> No
    q650_hepatitis650 --> No
    q649_hiv --> No
    q648_glaucoma648 --> No
    q730_osteoporosisOr --> No
    q731_dizziness731 --> No
    q732_vertigo --> No
    q733_neckInjury --> No
    q734_arteriosclerosis734 --> No
    q735_impairedBlood735 --> No
    q689_otherplease --> 
    q690_standard --> Emergency Contact
    q723_end --> 
    q278_system278 --> End

     

    I can not use this for my purposes, I need the actual questions, not the field IDs.

  • Profile Image
    DrFischer
    Answered on December 31, 2013 at 09:39 AM

    Thank you. The form email that is sent to me does have the labels instead of the IDs. Is there any eay to get the field labels from that?

  • Profile Image
    DrFischer
    Answered on December 31, 2013 at 09:42 AM

    Also, I am not sure I understand why not yo use webhook. What are the webhooks for? Thanks for teaching a rookie :)

  • Profile Image
    DrFischer
    Answered on December 31, 2013 at 01:49 PM

    thank you. I dont really understand how the hidden fild should work. Are you saying that for every field in my quesitonnaire, I should put a hidden field, that contains the field name? how will i know what field this name field is belonigng too? It looks I will also have to put the corresponding field id in that hidden field. with 200+ fields in a questionnaire, which is kind of a hassle...

    I could also put a hidden field into the form, that contains a colleciton of all field ids and their corresponding field labels. which is also kind of a hassle...

    but maybe I misunderstood?

  • Profile Image
    DrFischer
    Answered on December 31, 2013 at 04:22 PM

    Maybe there is another, much more elegant solution within jotform. The reason why I want the field labels and why I am doing a webhook is that I have to process the form data to create result data that I can copy/paste into my EHR system. Let me give you an example:

     

    My form would probably look like this:

     

    Respiratory
    ------------

    Stuffy Nose  - YES (PAST) NO
    Sinus Trouble  - YES (PAST) NO
    Frequent Sore Throat - YES PAST (NO)
    Shortness of Breath  -  (YES) PAST NO
    Cough  - YES PAST (NO)
    Chills -  YES (PAST) NO
    Difficulty Breathing  -  (YES) PAST NO
    Wheezing  - YES PAST (NO)
    Coughing Blood  - (YES) PAST NO

     

    Cardiovascular
    -------------
    Heart Murmur -  YES PAST (NO)
    Chest Pain  - YES (PAST) NO
    Palpitations  -  YES (PAST) NO
    Dizziness  -  YES PAST (NO)
    Fainting Spells  -   (YES) PAST NO
    Shortness of Breath  -  (YES) PAST NO
    Difficulty Lying Flat  - YES PAST (NO)
    Swelling Ankles   - YES (PAST) NO

    etc.

     

    The user's choices are marked with ()

     

    Now, I want the form to create the foillowing output:

     

    Respiratory
    -----------
    Patient reports Shortness of Breath, Difficulty Breathing, Coughing Blood.

    Patent reports past history of Stuffy Nose, Sinus Trouble, Chills.

    Patient denies history of Frequent Sore Throat, Cough, Wheezing.

     

    Cardiovascular
    --------------

    Patient reports Shortness of Breath, Fainting Spells.

    Patient reports past history of Swelling Ankles, Chest Pain, Palpitations.

    Patient denies history of Difficulty Lying Flat, Heart Murmur, Dizziness.

    etc.

     

    Is that possible within jotform, maybe with a report? That would be great, because then I would not need the webhook at all, I could just copy/paste it directly from the form result.

  • Profile Image
    DrFischer
    Answered on January 02, 2014 at 04:51 PM

    Hey, anybody out there who has an asnwer to this? thanks

  • Profile Image
    DrFischer
    Answered on January 02, 2014 at 06:54 PM

    Hi, thankyou for your reply. Your form soruce code solution sounds like a really good workaround, but the reason why I want to host it on your server is that you claim to be HIPAA compliant, and my forms collect personal identification date form my partients. I know this is tricky, but do you have any other ideas? thanks again

  • Profile Image
    Jeanette
    Answered on January 02, 2014 at 11:24 PM

    If you want to host the data in our servers, you do not need to use the workaround and send form data through PHP/MySQL,  you can still customize the source code of the form and still be able to send the data to our servers.

    For a better explanation on how to be HIPAA compliant using Jotform, let me tell you that  data stored on our servers is not encrypted, but access to our servers is safeguarded.

    Data transmission from the person who submits their health information to our servers can be done in an encrypted manner, by using the forms securely.

    Jotform certainly complies with the technical safeguard section of the HIPAA security rule:

    Information systems housing PHI must be protected from intrusion. When information flows over open networks, some form of encryption must be utilized. If closed systems/networks are utilized, existing access controls are considered sufficient and encryption is optional.

    But to achieve this, you must follow these advises:

    1. Always use SSL (https) version of Jotform site on your browser. Use "https://www.jotform.com" to login to your account, create your forms, look at your submissions and link to your forms.

    2. Edit emails on all forms to make sure no specific information is used on them. We send emails in plain text. So, they are not secure. Only use emails to get alerts to know there is a new submission. Once you receive an email alert, log into the secure Jotform site and then look at the user 

    3. If you use the Reports feature only do it with password protection. That will both ask for a password, and it will transfer all data over SSL.

    4. Same for uploads. They are not password protected.

    5. Logout immediate after you are done with the site.

    6. Regularly download submissions and then delete them.