Phone Number Element not posting to mySQL

  • lplatz
    Asked on October 19, 2019 at 10:11 PM

    Question to anyone who has saved their form data to their own mySQL database.  

    Has anyone experienced the phone number not posting to their database?  I'm using the "Phone" element from the form Basic section.  

    The I've tried using both "text" and "varchar" as the datatype in mySQL.

    All I'm getting are zeros (0) in the phone column.

    Suggestions welcome.  Will continue to search out this issue on the mySQL side.


  • lplatz
    Replied on October 19, 2019 at 10:24 PM

    Answering my own question... no issue exists with posting phone numbers to your mySQL database either masked or unmasked.  It was a simple syntax oversight on my part.  Overlooked the use of a CAP within one of my variable names.

  • Mike_G JotForm Support
    Replied on October 19, 2019 at 10:36 PM

    Thank you for updating us. We are glad to know that you were able to find a fix to your concern that you initially reported as an issue in this thread.

    Should you have other questions or concerns, please do not hesitate to contact us again anytime. 

  • lplatz
    Replied on October 19, 2019 at 10:50 PM

    I want to follow-up on the phone number element in the form builder.  As noted earlier, I used the phone element for my mobile form field.  I thought the field would be masked.  It is not, so I inserted a mask, turning on this feature in the options section.  Simple (###) ###-#### mask used.  By using this mask, it broke the phone field.  With a mask inserted into the field, the phone number will not post to my mySQL database.  So I removed the mask and instead manually inserted hyphens (-) between the sections of the phone number when entering this on the form.  (ie, 555-123-1234).  This also broke the field in terms of it posting to mySQL database.  What posted was the number up to the hyphen 555. The remainder of the number was truncated.  Is this truly broke, or is there a method I'm not employing correctly in order to use a mask or any other non-numeric character in this field?

    FYI - my table column in mySQL for the phone number is VARCHAR(15).

    I appreciate any feedback or similar experiences with this issue.

  • Kevin Support Team Lead
    Replied on October 19, 2019 at 11:54 PM

    I have been checking and using the varchar type should allow to receive the number on your table. I cloned the latest form you have edited which contains a "mobile number" field and it seems to be as short text entry element, I have enabled the input mask option and it seems to be sending the data correctly from our end as per the POST data, here is what I can see on my end: 

    15715429312019 10 19 21h25 36 Screenshot 10

    I would recommend you to kindly try using a phone number field and see if that helps: 

    15715433502019 10 19 21h26 11 Screenshot 21

    Also, if the problem persists, please try doing the following: Instead of using the parameter from the form such as "$_POST['mobilenumbr']" and inserting this value in your database, try setting a fixed value, so change the variable to something like " 555-123-1234" and see if this helps, this will also help us finding if the issue is related to how the data is formatted from the form too. 

    Let us know how it goes. 

  • lplatz
    Replied on October 23, 2019 at 6:11 PM

    Thank you Kevin_G for your spot-on direction for my issue.  I thought I had used the "Phone" form element for the input, but that was my mistake. I corrected using suggested "Phone" element and my mySQL database is now accepting the Phone field's data input.  My apologies for wasting your time on that issue.

    I do have a follow up.  The data entry for the phone field in my database is in the following format.  ###-#######.  I can certainly work with this, but is there a way to insert a hyphen between the 4 and 5 digits (counting from right to left).  This would be more reflective of a US phone number format.

    1571868490phone form entry Screenshot 10

    Thank you... I look forward to your feedback.


  • Mike_G JotForm Support
    Replied on October 23, 2019 at 6:35 PM

    To my understanding, you would like it to be in this format ###-###-####.

    May I suggest that instead of having a separate field for the Area Code in the Phone Number field, enable the Input Mask option of the field and set it to that format.

    1571869997zt18 32 28 Screenshot 10

    Reference guide: Getting-Started-with-the-Basics-of-Input-Masking