how to do this?

Discussion in 'PHP' started by badmasketa, Mar 14, 2008.

  1. #1
    i have one textarea input box. i entered the long texts with spaces, etc. I wanna put this texts in mysql table with those html tags like spaces, etc.
    and i wanna display the data exactly how i entered the text before? like if i had put spaces then it also should show exactly like that...

    is there any code to do that?
     
    badmasketa, Mar 14, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    nico_swd, Mar 14, 2008 IP
  3. badmasketa

    badmasketa Well-Known Member

    Messages:
    351
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #3
    www.php.net/nl2br
    this shows if the texts we entered has line breaks, isnt it?

    i want put in the table like this text:

    Well this guy Kiyoshi Baba is no more here in Nepal........he came here to Nepal on the 23rd of October,2003 as a Senior Volunteer for teaching nd conducting Traffic Management ........he was here on the request of the governement to JICA........here's wat he taught to the Traffics in his Traffic Management Seminar here in Nepal.....


    1. INTRODUCTION
    Nepal has only two transportation device,road and airplane,while other countries like Japan have various kinds of devices such asship, rail roads, subway, monorail and so on. You can say that is the feature of Nepal's transportation condition.Furthermore a flight is easily canceled because of bad weather, and vehicles will bethe only transportation device left. Therefore it is an urgent task to secure the safety of vehicle traffic.

    2. SAFETY COUNTERMEASURES
    Countermeasures of the traffic police for safety traffic are as follows:
    1- Securing the safety of vehicle traffic
    2- Promote the smooth traffic
    3- Prevention of traffic pollution
    We should promote them with great physical strength.

    3. CONCRETE PLAN
    Everyone knows that traffic accidents happen by physical contact of a vehicle and a vehicle, or a vehicle × a pedestrian. Then accidents can be prevented easily by preventing such a physical contact.Separation is the only thing which has to be done to prevent those physical contacts.The best way is to establish permanent structure,such as a median strip with shade trees. However, enormous amount of money is necessary for that. So I discussed with my counterpart Mr.Romendra DEUJA and decided to produce the cheap and simple block instead of that,and the blocks have been installed in main road of Kathmandu City by JICA's financialsupport. Each block was connected by rope, and it works perfectly to separate cars VScars, and cars VS pedestrians. After the installation, following effects have been observed.

    1- Straining onto the opposing lane and U-turn by vehicles and motorcycles have been stopped.
    2- Pedestrians' disorderly cross have been stopped.
    3- On-street parking vehicles have been reduced.
    4- The speed of passing vehicles have been increased.

    In order to make passage at night more safe,we are trying to install a light reflector to each block. Although the great effects of the installation of those blocks have been observed the urban transportation control isfacing financial difficulties.Your cooperation is welcome.

    ------- Mr. Kiyoshi BABA SV at Valley Traffic Police Office


    theres many line breaks there, does this line breaks goes to table if u entered this text??
     
    badmasketa, Mar 14, 2008 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    The line breaks from the textarea which you submit are new line characters (\n). You should enter these into the database since they take less space. But when outputting the text, you should apply the function I posted first. Because the browser interprets new line characters as spaces, and not new lines. You need to tell him in HTML that you want a new line: <br />

    The function above does that....
     
    nico_swd, Mar 14, 2008 IP
  5. badmasketa

    badmasketa Well-Known Member

    Messages:
    351
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #5
    ok will try this.. THanks Nico ;)
     
    badmasketa, Mar 14, 2008 IP