textarea line breaks

  • milbra
    Asked on July 16, 2014 at 11:05 PM

    I would like to send my form's information to my php code. The form contains 2 textarea fields. Each row represents one piece of data. When JotForm sends data to my code, it's in a single line. I need line breaks. How can I add the breaks?

    Email notification looks good.

     

  • Ashwin JotForm Support
    Replied on July 17, 2014 at 5:27 AM

    Hello milbra,

    I am not sure if I have understood your question correctly.

    It seems you are sending POST data and reading it in your own page. Do you mean to say that the post data is not displaying the new lines of the textarea value? It seems you need to "URLENCODE" the value of text area so that the newline formatting is preserved.

    In your custom thank you page where you are reading and displaying the content of text area, the code should be something as follows (not sure on the PHP syntax though) :

    <?=urldecode($_GET['ValueOfTextarea'])?>

    Hope this helps.

    Do get back to us if the issue persists.

    Thank you!

  • milbra
    Replied on July 17, 2014 at 9:39 AM

    Here's what I get when JotForm POSTs to my php...

    Jul 16, 2014 11:22:25 EDT
    Test Line 2
    aaaa bbbb ccccc dddddd, ff 12345 eeeee
    15.00
    PayPal

     

    This is what I would I want it to look like going to php
    (does in email and submission)...

    Jul 16, 2014 11:22:25 EDT
    Test
    Line 2
    aaaa
    bbbb
    ccccc
    dddddd, ff 12345
    eeeee
    15.00
    PayPal

    My php is initially exploding the textareas based on line break so I can insert individual values into a database. If I need to do what you said above (<?=urldecode($_GET['ValueOfTextarea'])?>), do I need to change GET to POST?

  • Ashwin JotForm Support
    Replied on July 17, 2014 at 11:00 AM

    Hello milbra,

    I am sorry for the confusion. I am not a PHP programmer and just gave you an example syntax you can use post.

    You may like to check the following guide for syntax:  http://www.pontikis.net/tip/?id=11

    Hope this helps.

    Thank you!

  • milbra
    Replied on July 17, 2014 at 11:23 AM

    Thanks, ashwin_d. I'm not a programmer either. I know just enough to "get by" :-)  When I tested my php code using HTML form (not JotForm), it added line breaks. Since it didn't with your forms, I thought it might be a JotForm issue.

  • Ashwin JotForm Support
    Replied on July 17, 2014 at 12:30 PM

    Hello milbra,

    Is your problem resolved now?

    If not, can you send me the source code of your "information-entry.php" file. You can exclude the DB connection string if you have any and we will surely try to resolve your issue.

    You can upload your source code here:  http://pastie.org/ and then send me the URL.

    We will wait for your response.

    Thank you!

  • milbra
    Replied on July 17, 2014 at 1:41 PM

    Thanks again for keeping in contact, ashwin_d. I think I have it working now.

  • KadeJM
    Replied on July 17, 2014 at 2:46 PM

    On behalf of my colleague whom was helping you we're glad to hear that. You are very welcome and if you have any further problems just let us know.