Web Analytics Made Easy -
StatCounter text file display problem... - CodingForum

Announcement

Collapse
No announcement yet.

text file display problem...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • text file display problem...

    firstly, i got i form that allow user to enter their description for some title. In the form i had an textarea that let user enter any string.

    then i will display based on the user adjustment in the textarea.
    for exmaple:
    user key in string 'abcd' then press 'enter' and continue key in 'edfg'....
    when the user submit, the pages should display
    abcd
    edfg
    at same time, it aslo write to a txt file based the user adjustment but must be in same line.
    continue upper example:
    the file should show display in "abcd<br />edfg"

    my problem is, i can do on html (display output) but i cant done what i want to do in text file.

    what i done in text file was:
    abcd
    <br />edfg

    i must done that, because this was an input to other program.

    anyone can help?

    thanks

  • #2
    When you bring in your <textarea>, let's say you named it "$caption" ...

    $caption = $_REQUEST['caption'];
    $caption = str_replace(chr(10), "", $caption);
    $caption = str_replace(chr(13), "\n<br />", $caption);

    Now when you save $caption in a file it will be:
    abcde
    <br />defgh
    <br />ijlkmn

    What it's doing.
    First, getting rid of the linefeeds (making them null),
    then changing the carriage returns to a newline and <br />

    Comment


    • #3
      what mean chr(10) n chr(13)???

      this only work at text file?? how about doc file??

      Comment


      • #4
        what mean chr(10) n chr(13)???

        chr(10) is linefeed
        chr(13) is carriage return

        It looks for those in the variable you've read from <textarea>,
        then substitutes them so they don't go into your text file the same way.

        You mentioned your problem was writing to the text file, not reading from it?

        Comment


        • #5
          ya...is writted to text file not read from text file..

          thanks a lot

          Comment

          Working...
          X