Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2008
    Posts
    12
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Adding <br /> when I press enter in form?

    I'm using php. I have a html form and want to automatically add <br /> when I preses enter. How can I do that?

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,636
    Thanks
    6
    Thanked 1,003 Times in 976 Posts
    Quote Originally Posted by javanoobie9 View Post
    How can I do that?
    With PHP, not with HTML. You may be looking for http://de2.php.net/manual/en/function.nl2br.php ?

  • #3
    New Coder
    Join Date
    Jan 2008
    Posts
    12
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    With PHP, not with HTML. You may be looking for http://de2.php.net/manual/en/function.nl2br.php ?
    So how can I get that to work with the form? I have a php page with a html form. How can I make that so when a user presses enter in the form it'll return a new line instead of a space?

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You don't. On the server side you store the text as normal. Then when you want to display it you run the text through the nl2br function. Learn to read the manual.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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