How to get the field name which needs to be used in PHP script to save data in MySQL?

  • ocalle
    Asked on May 25, 2017 at 11:56 PM

    Hello, i need help with this, i used the webhop php example but i have a doubt

    When you 

    //Replace the field names from your form here
    $fname = $mysqli->real_escape_string($obj['q15_yourName'][first]);
    $lname = $mysqli->real_escape_string($obj['q15_yourName'][last]);
    $email = $mysqli->real_escape_string($obj['q16_yourEmail16']);
    $message = $mysqli->real_escape_string($obj['q17_yourMessage']);

     

    In the field name you put Q15_yourname, in my form saw #input22 in field and a name of field up , which one fit in there?

     

    The error that appear is 

    New record added !!SQL error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '')' at line 1

    I dont know how can i solve this, if you need ill send my code is similar than the example. 

    This is your link example

    https://www.jotform.com/help/248-Webhook-PHP-Script-Examples

     

    Thanks in advance.

    Osvaldo

  • Ashwin JotForm Support
    Replied on May 26, 2017 at 1:33 AM

    Hello Osvaldo,

    Please note that you need to use the name of the form field. Please check the screenshot below on how to quickly find the field name to use in your PHP script:

    How to get the field name which needs to be used in PHP script to save data in MySQL? Image 1 Screenshot 20

     

    Hope this helps.

    Do get back to us if you have any questions.

    Thank you!

  • ocalle
    Replied on May 30, 2017 at 9:16 AM

    Many thanks, in the case that i have a control with multiple choice or a date with ranges how fill each one in mysql? and which is your animated tool to show my the answer?

     

    Thanks again

     

    Osvaldo

     

     

  • Ashwin JotForm Support
    Replied on May 30, 2017 at 10:51 AM

    Hello Osvaldo,

    I am not sure if I have understood your question correctly. Do you mean to say that you want to read the value of multiple choice question or a date field value in your PHP code? 

    If you are reading the POST data in your own PHP page, I believe you need to loop through the checkbox value. You may like to check the following URL for a sample script and see if that is that you wanted to ask:  https://stackoverflow.com/questions/18421988/getting-checkbox-values-on-submit 

    Do get back to us if you meant to ask something else.

    Thank you!

  • Ashwin JotForm Support
    Replied on May 30, 2017 at 10:53 AM

    Hello Osvaldo,

    To create animated gif, we use LICEcap tool:  https://licecap.en.softonic.com/

    Thank you!

  • ocalle
    Replied on May 30, 2017 at 1:31 PM

    Many thanks! I appreciate your time. Thank ill try with that.

  • ocalle
    Replied on June 6, 2017 at 7:08 AM

    Hello, I want ask if i can name each field to standarize a Mysql database, is there a way to rename it?

     

    Example  16_field as Myfieldsql 

     

    Thanks in advance

     

  • Ashwin JotForm Support
    Replied on June 6, 2017 at 8:21 AM

    Hello Osvaldo,

    Yes it is possible to rename the unique name of your form field. Please check the screenshot below:

    How to get the field name which needs to be used in PHP script to save data in MySQL? Image 1 Screenshot 20

    Hope this helps.

    Do get back to us if you have any questions.

    Thank you!