This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Upload text in html


  1. rscott7706
    Member

    I searched for an answer on this, hope I am not asking something that has been answered before.

    On a text paragraph field...

    I would like some forms to upload the text to database with html tags. As it uploads now and populates the database, all tags are stripped out.

    So for instance:

    This is text.
    This is text.

    Becomes:
    This is text.This is text.

    What I would like to see is:
    This is text. This is text.

    Is there a work around for this?

    Thanks!!
    Ron

    Posted 15 years ago #
  2. redityo

    Hi Ron,

    What HTML tag do you use ? I try with '<br>' , '<P>' tags it not stripped out. It give me same result with my paragraph text input.


    MachForm Support

    Posted 15 years ago #
  3. rscott7706
    Member

    Hey redityo,

    I mislead you.

    What I meant to say was that when typed in to the form and submitted, hard returns don't show up in the database (so my reference to "html tags").

    Here is a sample:

    http://www.lakesideca.com/chamber/chamber_events/chamber_events.php

    When entering the text in Machform (Paragraph Text), I put:

    Test
    Hard return
    Test
    Hard Return

    It shows up on the website as:
    Test Hard return Test Hard Return

    I hope I was more clear this time.

    Ron

    Posted 15 years ago #
  4. redityo

    Hi Ron,

    I try to figure it :) ... I hope my answer meet your expectation. Basically text area consider a white space as carriage returns and it will not rendered in HTML.
    However you can use nl2br() function to show the line break in HTML to your output. You can refer to this :

    http://www.plus2net.com/php_tutorial/line-breaks.php

    But if you consider to save "break" tags in database, you should edit your "post-functions.php" file, try to search around line 201. You will see this code :

    $table_data[$element_name] = $element_data;

    replace it with

    if ($form_id == 23 && $element_id == 2) {
    	$table_data[$element_name] = nl2br($element_data)	;
    } else {
    	$table_data[$element_name] = $element_data;
    }

    in there i assume your paragraph text in form 23 with element id = 2


    MachForm Support

    Posted 15 years ago #
  5. rscott7706
    Member

    Top of the morning, redityo

    Works perfectly... Another support issue defined and dealt with!!

    Thanks for your prompt and professional help.

    Ron

    Posted 15 years ago #

RSS feed for this topic

Reply