Is it possible to update the value of a field in existing submission through PHP code?

  • rrgrou
    Asked on March 14, 2016 at 2:07 PM

    I made a hidden field in my form.

    The name of that field is : PAYED and the default value of that field will be NO

    After completing the form i go to my payment provider by pushing the SEND button.

    At that moment the submission is saved and i am leaving the form.

    There i use a php script to make the payment.

    After the payment is done i like to update the hidden field PAYED with the value YES

    That can also be done in the php script.

    Is it possible to update one field (in my case the PAYED field) by sending it to a URL adres

    like you do in Prepopulating-fields-to-your-JotForm-via-URL-parameters

    https://form.jotform.com/53533976064967/XXXXXXXX?PAYED=Yes

    XXXXXXXX will be the attribute of the specific submission.

     

    Jan Spijkerman

  • Ben
    Replied on March 14, 2016 at 2:44 PM

    It would not be possible to do the same over URL pre-population, since that would make a new submission, but for that to be possible it would require your PHP script to activate the submission as well.

    This would however be possible by using the API.

    You can see more about it on the following link: http://api.jotform.com/docs/#post-submission-id

    On the top left you would be able to select "PHP" as the script of the choice (or some other if you prefer).

  • rrgrou
    Replied on March 14, 2016 at 2:59 PM

    Thanks for your answer, but how can i read the submisson ID number in my PHP script

    like i use for fieldname <?php $var1=$_POST["fieldname"] ?>

  • Ben
    Replied on March 14, 2016 at 3:10 PM

    You are welcome. Submission ID should be seen as "ID".

    What I do recommend is to check the form fields that you get sent to your PHP script by looking at the request bin.

    You can see it here: RequestBin — Collect, inspect and debug HTTP requests and webhooks

    This is done by sending a test request after setting up the webhook: How to Setup Webhook with JotForm

    That will help you quickly get all of the fields from your form in the data that it is sent allowing much easier codding of your own scripts.