What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.

  • Profile Image

    Does anyone have example php for webhooks to MSSQL?

    Asked by bjorn.kvinge298 on June 26, 2017 at 03:54 PM

    Hi, I have tried to get data from webhooks to my Azure database using php, but with no luck.


    Now I have just managed to solve it with using mysql instead and with help from all the examples on this forum.

    But still I want to make this in Azure and with MSSQL.

    Can someone please share examples of php for communicate and send webhooks data to a MSSQL database?


    Thanks for any hints or tips :)




  • Profile Image
    JotForm Support

    Answered by aubreybourke on June 26, 2017 at 04:12 PM

    You can find some webhook php examples here:

    Webhook PHP Script Examples 

    (#3. specifically allows you to send your form data to a MySQL database).

  • Profile Image

    Answered by bjorn.kvinge298 on June 26, 2017 at 04:24 PM

    Thanks aubreybourke, these was one of the examples that helped me understanding the communication to mysql.

    But I need examples of php scripts that can be used to MSSQL.

    So far I have managed to connect to the MSSQL database successfully, and I can query it.


    So I just need help with defining and sending data (I think).




  • Profile Image
    JotForm Support

    Answered by BDAVID on June 26, 2017 at 06:26 PM

    We do not have examples with MSSQL. We only have with MySQL: https://www.jotform.com/help/126-How-to-send-Submissions-to-Your-MySQL-Database-Using-PHP 

  • Profile Image

    Answered by bjorn.kvinge298 on June 26, 2017 at 06:37 PM

    Ok, thanks!


    Desperate attempt on a php script, the connection is working.

    $conn = sqlsrv_connect($serverName, $connectionOptions);


    $fieldvalues = $_REQUEST['rawRequest'];

    $obj = json_decode($fieldvalues, true);

    $sid = $conn->real_escape_string($_REQUEST['submissionID']);

    $MekaniskAnsatt = $conn->real_escape_string($obj['q5_mekaniskAnsatt']);

    $ElektroAnsatt = $conn->real_escape_string($obj['q102_elektroAnsatt102']);


    $insertSql = "INSERT INTO Timeføring (SubmissionID, MekaniskAnsatt, ElektroAnsatt) 

    VALUES (?,?,?)";

    $params = array(&$_POST['$sid'], 



    $stmt = sqlsrv_query($conn, $insertSql, $params);





  • Profile Image
    JotForm Support

    Answered by liyam on June 26, 2017 at 09:03 PM

    Hello McQuinge,

    Thank you for sharing the code with us. We'll gladly take note of this.

    I see that you are using the SQLSRV driver of the PHP Microsoft Drivers for SQL Server. The difference between MSSQL and MySQL when coding with PHP are function names on connecting to its database. Since the usage of PHP is more common with Linux and MySQL databases (and as this combination is most common on web hosting service providers), the guide that we have set to provide is for PHP and MySQL, with also the assumption that the account owner has already setup his PHP with MySQL properly.

    But it's not completely different when calling database functions. This may also further help you on coding PHP with MSSQL via SQLSRV: https://docs.microsoft.com/en-us/sql/connect/php/how-to-perform-transactions

    Here is also a list of functions available on PHP's website: http://php.net/manual/en/book.sqlsrv.php 

    If you have questions or if you still have hurdles on this matter, please let us know.