- nitehikeAsked on January 22, 2014 at 11:10 PM
I'm wanting to use the submission data in a database of my own, and I've been trying to get that data into a friendly version. Using POST, the only value that was getting sent to my database was the FormID, with everything else being left blank. Instead, I'm trying to use the webhooks....and I can view everything through requestbin, but I think I'm not getting any entries into my database because I'm trying to get submissionID in the wrong way. Do you have to jcon_decode it like the other hook tags, or can you just use a POST on it? Help?
- JotForm SupportEltonCrisAnswered on January 23, 2014 at 12:07 AM
Have you tried checking the Webhook guide first? https://www.jotform.com/help/245-Creating-your-first-Webhook-with-JotForm
You can actually use POST for submissions ID. It should be:
But if the data is decoded to PHP variable with example ($obj variable):
$obj = json_decode($requestbinresult, true);
then the code will become:
Let us know if you still have difficulties.
- nitehikeAnswered on January 23, 2014 at 10:41 AM
Yea, everyone likes to quote that getting started with webhooks guide, but it's really not as useful as it should. So if I get this straight, it returns the formID and submissionID as it's own objects, and it returns the entire block of form data as a single array?
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
$result = stripslashes_deep($_REQUEST['rawRequest']);
//Convert json to php variable
$obj = json_decode($result, true);
$submission_id = $obj['submissionID'];
$formID = $obj['formID'];
$doesyour = $obj['q72_doesYour'];
So that should theoretically work? Or do I need to pull out submissionID and formID before striping slashes and decoding the strings? Or can I combine POST and the json decode in a single webhook page, as long as the POST stuff comes first?
- JotForm SupportEltonCrisAnswered on January 23, 2014 at 11:15 PM
My apologies for the confusion. Actually the json decode is for the rawRequest data only which does not includes the formID and the submissionsID. In other words, you can use $_POST[submissionID] directly.
Example would be (if you're going to assign it with variables):
$submission_id = $_POST[submissionID];
$formID = $_POST[formID];
Let us know if you have further questions. Regards!
- nitehikeAnswered on January 23, 2014 at 11:54 PM
That's fantastic! I look forward to trying to make this work! Thanks. Should update the Webhooks guide at some point with that little morsel. Thanks again. I just wish I could get back the 25 test submissions I made on my account trying to get it to work! ;-)
- nitehikeAnswered on January 24, 2014 at 12:03 AM
And with that one little tweak the whole thing works! The way I set my database up I'm using the submissionID as my unique key, so it was critical for everything. Thanks!
- JotForm SupportjonathanAnswered on January 24, 2014 at 05:32 AM
We are all glad to know of your satisfaction on this. And our colleague EltonCris is highly commended as well for fantastic support.
Contact us again anytime if there is more we can help you with.