Webstie Designer Webstie DesignerWebstie DesignerWebstie DesignerWebstie Designer
 
 
Cheap Webstie Designer Cheap Webstie Designer Cheap Webstie Designer Cheap Webstie Designer Cheap Webstie Designer Cheap Webstie Designer
 
 

How to make textarea tet display properly after saving it to a MYSQL database

 

You may find that when you save text from a form to a MYSQL database or to be sent in an email it doesn’t print character like quotation marks and other symbols. You will also notice that it doesn’t print new lines; this is because when it saves the data it stores new lines and “line feed” and “Carriage Return”  and theses need to be transformed into <br> in order to be displayed correctly.

Now to sort out the symbol problem you need add this line of code in PHP

$textthathasbeenentered = addslashes($textthathasbeenentered);

Then save the data to the database

When you return the result instead printing

echo $textthathasbeenentered;

Print

echo nl2br($textthathasbeenentered);

It’s a little known built in PHP function and will sort this problem out for you

 

 
  Webstie DesignerCheap Webstie Designer