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

    Hi,My database is in OVH, how can I do to link my forms to my database?

    Asked by infoges on July 12, 2012 at 10:17 AM

    Hi,

    My database is in OVH, how can I do to link my forms to my database?

    thank you to yours answers



    This is a re-post of a comment on How to send Submissions to Your MySQL Database Using PHP

    My Forms
  • Profile Image
    JotForm Support

    Answered by liyam on July 12, 2012 at 10:44 AM

    Thank you for posting your inquiry, infoges.

    1st thing you should do is enable the Send Post Data option in the form that you wish to use.  Then prepare your custom thank you page that will handle the post data to be submitted by your form. You can read through this user guide on the steps to do before being able to insert the submitted data to your database.

    Can you enumerate the things you've done so far and the form that you will use? 

    Looking forward to your response.

    Thanks.

  • Profile Image

    Answered by infoges on July 13, 2012 at 05:58 AM
    Hi,
    I have already done this step for now, my only problem is my database
    linker that
    is at OVH to my news page.
    Thanks, But can we speak french please.
    Cordialement Mouhamadou Saliou GUEYE
    Mouhamadou Saliou Gueye
    infoges@reseaumedical.fr
    RMS-SI
    2012/7/12 JotForm Support Forum
  • Profile Image
    JotForm Support

    Answered by liyam on July 13, 2012 at 12:38 PM

    Unfortunately, I don't understand french.  But feel free to use it if that's what's comfortable for you.  I'll do my best to understand.

    Before we can start, can you tell me which form is it that you're going to use, and also, do you have your website PHP scripting language enabled?  We'll need this to be able to parse the post data submission from your form to your database.

    Will be waiting for your response.

    Thanks.

  • Profile Image

    Answered by infoges on July 16, 2012 at 03:59 AM
    Hello, Thank you for your response. My site is PHP, and I used JOTFORM for
    forms. My database is MySQL with three tables, my goal is to store the
    information
    found in my form to my Mysql database. If you want I can send you the
    source code of my web page.
    Cordialement Mouhamadou Saliou GUEYE
    Mouhamadou Saliou Gueye
    infoges@reseaumedical.fr
    RMS-SI
    2012/7/13 JotForm Support Forum
  • Profile Image
    JotForm Support

    Answered by liyam on July 18, 2012 at 03:46 AM

    Hello infoges.  Can you provide us the user ID or the URL of the form which you're going to use on this? 

    Thanks.

  • Profile Image

    Answered by infoges on July 18, 2012 at 04:11 AM
    Hello,
    I send you the URL of the forms :

    thanks, cordialy.
    Cordialement Mouhamadou Saliou GUEYE
    Mouhamadou Saliou Gueye
    infoges@reseaumedical.fr
    RMS-SI
    2012/7/18 JotForm Support Forum
  • Profile Image
    JotForm Support

    Answered by liyam on July 18, 2012 at 04:26 AM

    Hello.  Unfortunately the URL did not appear.  Can you reply by visiting this link instead?

    Thanks.

  • Profile Image

    Answered by infoges on July 18, 2012 at 04:51 AM

    I'm sorry

    here is the URL:

    <script type="text/javascript" src="//form.jotformeu.com/jsform/21932129099357"></script>

    thanks.

  • Profile Image
    JotForm Support

    Answered by liyam on July 18, 2012 at 01:10 PM

    Thank you for the information, infoges.

    Here's what you should do:

    1. Edit your postvars.php file and use this code:

    <?php

    // This function will run within each post array including multi-dimensional arrays
    function ExtendedAddslash(&$params)
    {
            foreach ($params as &$var) {
                // check if $var is an array. If yes, it will start another ExtendedAddslash() function to loop to each key inside.
                is_array($var) ? ExtendedAddslash($var) : $var=addslashes($var);
                unset($var);
            }
    }

    // Initialize ExtendedAddslash() function for every $_POST variable
    ExtendedAddslash($_POST);    
    $submission_id = $_POST['submission_id'];
    $formID = $_POST['formID'];
    $ip = $_POST['ip'];
    $auteur = $_POST['auteur'];
    $titre4 = $_POST['titre4'];
    $annonce = $_POST['annonce'];
     

    $db_host = 'db hostname here';
    $db_username = 'db username here';
    $db_password = 'db password here';
    $db_name = 'name of your database';

    mysql_connect( $db_host, $db_username, $db_password) or die(mysql_error());
    mysql_select_db($db_name);

    // search submission ID

    $query = "SELECT * FROM `table_name` WHERE `submission_id` = '$submission_id'";
    $sqlsearch = mysql_query($query);
    $resultcount = mysql_numrows($sqlsearch);

    if ($resultcount > 0) {
     
        mysql_query("UPDATE `table_name` SET
                                    `auteur` = '$auteur',
                                    `titre4` = '$titre4',
                                    `annonce` = '$annonce'
                                     
                                 WHERE `submission_id` = '$submission_id'")
         or die(mysql_error());
      
    } else {

        mysql_query("INSERT INTO `table_name` (submission_id, formID, IP, auteur, titre4, annonce)
                                   VALUES ('$submission_id', '$formID', '$ip', '$auteur', '$titre4', '$annonce') ")
        or die(mysql_error());

    }
    ?>

    2.) Please do take note that you will need to have these field names in your database table:

       a. submission_id
       b. formID
       c. IP
       d. auteur
       e. titre4
       f. annonce

    3. Replace the values of these variables and use your database connection information:

    $db_host = 'db hostname here';
    $db_username = 'db username here';
    $db_password = 'db password here';
    $db_name = 'name of your database';

    Please let me know if you need further assistance.

    Thanks. 


  • Profile Image

    Answered by infoges on July 20, 2012 at 05:14 AM
    First I thank you to reply to my answer.
    But I can't identify the submission id, IP and the FormID. Then all the
    other is best.
    cordially MSG.
    Cordialement Mouhamadou Saliou GUEYE
    Mouhamadou Saliou Gueye
    infoges@reseaumedical.fr
    RMS-SI
    2012/7/18 JotForm Support Forum
  • Profile Image
    JotForm Support

    Answered by liyam on July 20, 2012 at 12:26 PM

    Hello.  The variables for the submission id, IP, and FormID are there in the script:

    $submission_id = $_POST['submission_id'];
    $formID = $_POST['formID'];
    $ip = $_POST['ip'];

    I also noticed that you have set your custom URL to fxr's sample page.  Do you already have your own thank you page which will gather these information?  The script and the instructions I gave is already straight to the point and there is no need to identify the submission ID, IP, and Form ID anymore as these are already set and will insert to your database, provided that you have followed the instructions I gave above.

    If there is something that you need further understanding, please do let us know.

    Thanks.

  • Profile Image

    Answered by khrisell on July 04, 2013 at 07:26 PM
    Greetings!

    We are happy to announce that we have released Jotform Webhooks,  this feature would replace Send Post Data + Custom URL Thank You Page workaround in order to help you transfer forms data to your own database using your own script codes.

    To know more about Jotform Webhooks, please click here.

     

    Thank you for using JotForm. :)