Form submission data is not posted to PHP thank you page .

  • ifin2000
    Asked on March 23, 2017 at 4:45 AM

    Hi,

    I need your help.

    when I redirect webhook to https://www.jotform/show-data-post/ there are correct output (array and php code $_POST[...])

    but where I redirect to my php script to catch POST data, array is blank, no data any more.

    print_r($_POST);

    $id_post = $_POST['submission_id'];

    $id_form = $_POST['formID'];

    $ip_addr = $_POST['ip'];

    $nama = $_POST['nama'];

    $mail = $_POST['email'];

    where is the mistake?

    please help me,

    because I had already fallen in love with jotform :)

    thanks

  • Ashwin JotForm Support
    Replied on March 23, 2017 at 6:36 AM

    Hello,

    I did check your last edited form "Register" and you seems to have not enabled "Send Post Data"  option. That is the reason why your form's submission data is not being posted to your PHP thank you page. I would suggest you to please enable "Send Post Data" setting in your form and that should solve your problem. Please check the screenshot below on how to enable it:  

    Form submission data is not posted to PHP thank you page  Screenshot 20

    Hope this helps.

    Do try it out and get back to us if you have any questions.

    Thank you!

     

  • ifin2000
    Replied on March 23, 2017 at 9:35 AM

    Thank you for your response, but I still have same problem with your suggestion.

    I tried 2 PHP different files (from jotfoem samples) to catch the variables, but all of them failed.

    1. this script has nothing result (no data at database)

    <?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);      

    $id_post = $_POST['submission_id'];

    $id_form = $_POST['formID'];

    $ip_addr = $_POST['ip'];

    $nama = $_POST['nama'];

    $mail = $_POST['email'];

    $nohp = $_POST['nohp'];

    $klin = $_POST['klinik'];

    $kota = $_POST['kota'];

    $saat = date('Y-m-d H:i:s');

     

    $db_host = 'localhost';

    $db_username = '....';

    $db_password = '.....';

    $db_name = '....';

     

    mysqli_connect( $db_host, $db_username, $db_password) or die(mysqli_error());

    mysqli_select_db($db_name); 

    mysqli_query("INSERT INTO user_detil (login,nama,klinik,software,phone,sumber,asal,mulai,status) VALUES ('$mail','$nama','$klin','Kesehatan','$nohp','$kota','$ip_addr','$saat','aktif')") 

        or die(mysqli_error());

    ?>

     

    2. this script can insert data to database but all variables from my form is blank

    <?php

    /******************************************************

     JotForm to MySQL Database Through Webhook

    Sample Script By Elton Cris - JotForm Tech Support

    Tested on form https://form.jotform.com/62893435003959

    You can submit this form and check results on http://eltoncris.xyz/view.php

     ******************************************************/

     //Replace with your DB Details

    $servername = "localhost";

    $username = "....";

    $password = "....";

    $dbname = "....";

    $dbtable = "user_detil";

     //Create connection

    $mysqli = new mysqli($servername, $username, $password, $dbname);

     //Check connection

    if ($mysqli->connect_error) {

        die("Connection failed: " . $mysqli->connect_error);

    }

     //Get field values from the form

    //Get unique submissionID - nothing to change here

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

     

    //Get form field values and decode - nothing to change here

    $fieldvalues = $_REQUEST['rawRequest'];

    $obj = json_decode($fieldvalues, true);

     

    //Replace the field names from your form here

    $ip_addr = $mysqli->real_escape_string($obj['ip']);

    $nama = $mysqli->real_escape_string($obj['nama']);

    $mail = $mysqli->real_escape_string($obj['email']);

    $nohp = $mysqli->real_escape_string($obj['nohp']);

    $klin = $mysqli->real_escape_string($obj['klinik']);

    $kota = $mysqli->real_escape_string($obj['kota']);

    $saat = date('Y-m-d H:i:s');

     

    $result = $mysqli->query("INSERT INTO $dbtable VALUES ('$mail','$nama','$klin','Kesehatan','$nohp','$kota','$ip_addr','$saat','aktif')");

        echo "New Record Added!";

        if ($result === false) {echo "SQL error:".$mysqli->error;}

    $mysqli->close();

    ?>

    result :

    Form submission data is not posted to PHP thank you page  Screenshot 20

    I hope you can help me :)

    Thanks before,

  • Ashwin JotForm Support
    Replied on March 23, 2017 at 11:52 AM

    Hello ifin2000,

    It seems you are using webhook integration and not posting your form's submission data to your own PHP thank you page. Sorry about the confusion. 

    Lets first try to figure out if the form data which you are reading in PHP page has value. data not being inserted in MySQL table is a secondary issue. Can you please debug your PHP script and see if the POST data has values which you are trying to read?

    We will wait for your response.

    Thank you!