in reply to Re: Formatting Input
in thread Formatting Input

Thank you for your reply, infact thanks to everybody for your replies. Having now had my problem pointed out to to me i now feel a complete fool because i should of known what the problem was myself

Now i have had the problem pointed out to me i now understand my problem and with this i can now find an answer. I shall explore using the <pre> tags and adding this to my my CSS to format the texts font style, color and size and then enclose the text into <div> tags to restrict width of the text area

Not realy thought it through yet though, a job for monday next week

This, or whatever i finally use will resolve my HTML printed back to the browser and printed in the email but won't resolve the problem when printed into the PDF Document so i'll explore this problem later next week

Thank you all for your help.

Replies are listed 'Best First'.
Re^3: Formatting Input
by ww (Archbishop) on Jun 15, 2012 at 12:51 UTC
    <moment>DUH! It just occurred to me that you're probably not taint-checking the user input.</DUH-moment>

    That's dangerous; DANGEROUS, I say.

    Use taint checking on user input, always! (and using <pre> is not nearly as good a cure for your problem as a variant of advice offered above: s/\n/<br>/m;)

      $Contents =~ tr/\n/<br>/ and $Contents =~ s/\n/<br>/ don't work and give an undesirable result, i haven't tried $Contents =~ s/\n/<br>/m though.

      However the <pre> tags give me what i'm looking for but in the wrong text font style, size and color as expected and the text is displayed with its blank lines and the text goes right off the edge of the screen.

      This gives me something i can work with

      I will try using $Contents =~ s/\n/<br>/m when i can on monday to see what it gives me

      Thank you

      Adding the code $Contents =~ s/\n/<br>/m; has no effect at all i'm afraid

      White space and new lines are lost

      Adding the code $Contents =~ s/\n/<br>/m; does have an effect in that looking at the source code printed to the browser on the first newline only <br> is added but not on any other newline after that

      Using the code $Contents =~ s/\n/<br>/mg; works a treat

        Yup.

        My fault for gorfetting the /g.   :)

        However, your post above says:

        "Adding the code $Contents =~ s/\n/<br>/m; has no effect at all i'm afraid"

        but one line later you state the opposite:

        "Adding the code $Contents =~ s/\n/<br>/m; does have an effect in that looking at the source code printed to the browser on the first newline only is added but not on any other newline after that"

        You can't have it both ways!

        You may have noted above (at Re^5: Formatting Input) that I objected to use of pronouns that are "(u)nclear, ambiguous, lacking a clear antecedent.... Please add "posts with mutually contradictory statements" to the list of modes that make good help harder to provide.

        So, please, next time you have a question to post, consider this:
        to help effectively we need to know the details of what you're doing... and the details of what's going wrong (errors messages, warnings, output that isn't what you want and so on). The third para of your latest node pretty much satisfies that, albeit with narrative description rather than samples. But we could have gotten to this apparently satisfactory solution at "Re: Formatting Input" had you provided a clear, complete SOPW.