Prepopulate form from a mySQL database

  • Profile Image
    Asked on December 09, 2015 at 08:35 PM

    I would like the ability to prepopulate a form with data from a mySQL database.  I have all the php database handlers written and tested but don;t know where/how to insert the code to SELECT from the database.

    The returned data could consist of multiple rows for display.  The user would select one, enter more data and click a button to update the database

    Alternatively, there could be a field on the form in which the user keys an id number and the single rowrelated to that id number would be displayed.  The user would then proceed as above.

    I don't need help with the php or database access, just how to implement the above within a fomr.



  • Profile Image
    Answered on December 10, 2015 at 01:10 AM

    Unfortunately, this is not possible to achieve inside of the form builder. The currently available functionality is the other way around - that is exporting or pushing the data to your database form the form data/value.

    If you have the programming resource, you can create a custom program using server side programming like PHP to create an interface/connection to pull data from your database to the form fields. You will also need to use the form's full source code then.

    As an alternative process, if the objective is to be able to pre-fill the form fields with data or pre-populate the form submission's data with data from external data source.

    Field Prepopulator - you can pre-populate the form fields before you can let the users use the form.

    A similar undertaking had been done on this thread (you may want to review it also for some useful tips)

    I also did a bit of google search and found this 


    Hope this will help. Let us know if you need further assistance.

  • Profile Image
    Answered on December 10, 2015 at 12:45 PM
    Thanks for the suggestions. Doesn't look like the Field Prepopulator helps
    since it doesn't interface with a database, and the links in the thread you
    pointed to are no longer active.
    It's looking like it will be hard to go the prepopulate route so is my
    alternative possible, which is:
    - Create a form with one input field, a submit button and some hidden
    - The user enters the id of the database record needed (they will know
    that) and clicks Submit.
    -I use Webhooks to direct the data to a php script on my server which gets
    the data.
    - The hidden fields to display the data are made visible and populated by
    my php script.
    Is that possible? If not I think I will have to create my own form with
    html and handle all the processing myself using POST.
  • Profile Image
    Answered on December 10, 2015 at 01:10 PM

    You can try to connect your form with Webhook in order to prepopulate fields inside of your form. This guides can help you: 

    It is a bit complex and will require some programming also.

    Hope this will help. Let us know if you need further assistance. 

  • Profile Image
    Answered on December 10, 2015 at 01:45 PM
    OK, I think you just gave me an idea. I'm already using a customized thank
    you page to add data to my database so I think the following will work.
    - Create a form with one input field and a submit button
    - User enters key of required db record and clicks submit
    - I set up a customized php thank you page that gets the id in the $_POST
    variable, gets the data from the db and creates the necessary html to
    display it.
    The only remaining piece is that the user needs to then click a button to
    "approve" the data he sees. Hopefully I can create the button via the php
    script and direct it to another php script to do the db update.
    Does that sound like it will work? I don;t want to go charging down this
    path only to hit a roadblock!
  • Profile Image
    Answered on December 10, 2015 at 02:04 PM

    Yes, this would be possible. You must however make your own PHP code that will get the data from the DB and then enter it into form. You can do that either through redirections (user goes to one page, where the data is retrieved and then the user is taken to another form with url prepopulated values) or you can use the source code of the form to echo the values of the variables that you got when the user got to your website.

    Feel free to contact us if you have any other questions.