Results 1 to 3 of 3

Thread: Textarea - Hyperlinks & Breaks

  1. #1
    Join Date
    Jan 2007
    Posts
    94
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Cool Textarea - Hyperlinks & Breaks

    I'm using a textarea on my site to allow users to post comments. When they enter in a link, it shows up as plain text and not as a hyperlink. Also, when they enter breaks (enters) to space out their comment, it doesn't show that either (it just bunches it all up).

    How can I go about getting these things to work? Or is using a textarea a bad choice??

    i just love the eek face.

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    You must be using a server-side on the backend to post the comments. Which PHP a simple str_replace, preg_replace would work. The link is a little (actually, alot) more complicated. It's skimming the surface of BBCode.
    Here's the answer for the line breaks:
    Code:
    <?php
    $new = str_replace("\n","<br>",$originaldata)
    //do something with $new (echo for example)
    ?>
    Whereas you would change $originaldata to what was being sent.
    It would help more if you described the situation better, or gave the code.
    - Mike

  3. #3
    Join Date
    Jan 2007
    Posts
    94
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Yeah, I'm using php to display the data gathered from the textarea box.

    The breaks now work, so thank you very much for that! As far as displaying links, is there a tutorial or something on this?

    Thanks!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •