FREE tutorial,solution,RSS Feeds on Operating Systems, Programming, Web Development, Applications, Databases, Networking, Hardware, Security, SEO Free Expertsforge Membership
Join us as Moderator
Submit Article to Expertsforge.com Submit Article My Expertsforge
 
RSS Feeds, Help Help RSS Feeds
bannertop
 

PHP Tutorial: Display contents from the database with exact formatting as typed in textarea using PHP

jawahar
11/11/2005 5:05:27 AM, Views: 1970
The following tutorial with code can be used to display the contents from the database into the HTML or PHP pages with formatting like 'ENTER' or 'TAB'. It will preserve the formatting as it is typed in the text area.

1. Add the following property to the textarea

<textarea name="tarea" WRAP="virtual"></textarea>

2. Add the following code where the contents from the MySQL database is retrieved and displayed :


<?php
$string = str_replace("\r\n", "<br>", $string);
$string = str_replace("\n\r", "<br>", $string);
$string = str_replace("\r", "<br>", $string);
$string = str_replace("\n", "<br>", $string);
print("$string");
?>
Next Steps:
Add this Tutorial to:
Blink Blink del.icio.ous Del.icio.us Digg Digg
Fark Fark Furl Furl Google Google
Reddit Reddit Simpy Simpy Spurl Spurl
Technorati Technorati Windows Live Win Live Yahoo Yahoo
Rate Me!
Not Yet Rated!
Rate:
Send Private MessageSend Message
Signup / Login To View the Solution or Provide Comments
Post Comment/Solution
Comment:*
        (Link Rules) 
  Use : [bold] for <b>; [/bold] for </b>; [italic] for <i>; [/italic] for </i>; [code] & [/code] for code
 
Categories
Options
PHP RSS Feed
Most Popular Tutorial
Most Popular Solution
No Records!
Top Rated
Top Rankers
Overall
1. jawahar (500)
Yearly -2008
No Rankings!
Expertsforge Sponsors
bnrtop