force to go to another line

Discussion in 'PHP' started by unlisted80, Sep 27, 2006.

  1. #1
    Hello alls

    can someone help me...okay when the user type in the text form and hit entter for example like this

    dsiplay like this
    result should be like this
    in order display the result the user have to type
    ..i just don't want user type br in other to go to another line


    if you think you can help me with this please please and please pm me


    many thanks in advance
     
    unlisted80, Sep 27, 2006 IP
  2. Evoleto

    Evoleto Well-Known Member

    Messages:
    253
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    
    echo nl2br( $_POST['field_name'] );
    
    PHP:
     
    Evoleto, Sep 27, 2006 IP
  3. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi!

    Your question is a tad vague.

    If you just want to preserve formatting, use text/plain instead of HTML.

    If you want to preserve formatting within HTML, you can use the <pre> tag, or do as Evoleto suggests.

    Regards
    - P
     
    penagate, Sep 27, 2006 IP
  4. unlisted80

    unlisted80 Peon

    Messages:
    644
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i try this but still not working :)
     
    unlisted80, Sep 27, 2006 IP
  5. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #5
    There's a good chance that it doesn't work directly: you haven't told us the input name nor the method of the form.

    Having said that, the answer is 'nl2br'. Now, no offence intended, but unless you can give us something more than 'I tried but it's still not working' you're just coming across as lazy.

    When you found that that didn't work, what did you do? Did you run to php.net and find out what nl2br actually does? Did you then think about it then try some other things? Did you sub in the actual field name or what?
     
    TwistMyArm, Sep 27, 2006 IP
  6. unlisted80

    unlisted80 Peon

    Messages:
    644
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    i am newbie to php but i think nk2br mean brb in php language :)

    sorry i didn't post the whole script because i am not comfortable to show the form because i notice that we as a member can't edit our own thread :)

    that why my first post in this subject i am asking people to pm me :)
     
    unlisted80, Sep 27, 2006 IP
  7. Evoleto

    Evoleto Well-Known Member

    Messages:
    253
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #7
    PM answered
     
    Evoleto, Sep 27, 2006 IP
  8. unlisted80

    unlisted80 Peon

    Messages:
    644
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thanks very much Evoleto...

    work perfect.


    thanks once again
     
    unlisted80, Sep 27, 2006 IP