SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2011
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how do i create paragraph spaces in my 'imput text Field '

    Hello everyone

    i am a bit confused over this issue.

    i have a text imput field in which user can write a bio about themselves;


    PHP Code:

    <textarea   name="essay" cols="30" rows="15"
            
    style="font-family: Tahoma; width: 420px;    font-size: 12pt"
                
    /> 

    Although i am able to receive all the information imputted by the user, it does not leave any paragraph space. i.e if the user presses the 'sift key' while writing, thus creating 'white space', this is not saved when the information is sent to my database.

    what am i doing wrong; is there a way to generate automatic paragraph tags within the imput filed?

    thank you for your help


    Andreea

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Lets say your form is POSTed to the form handler.
    PHP Code:
    <?php

    // echoed without doing anything about new lines

    echo $_POST['essay'];

    // compared to :

    echo nl2br($_POST['essay']);
    Does that help?

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2011
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face

    Wow. that is great.

    my warmest thanks to Cups for the function that creates line breaks .

    it works perfectly.

    thank you.



    Quote Originally Posted by Cups View Post
    Lets say your form is POSTed to the form handler.
    PHP Code:
    <?php

    // echoed without doing anything about new lines

    echo $_POST['essay'];

    // compared to :

    echo nl2br($_POST['essay']);
    Does that help?


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
  •