Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing text areas in MYSQL

Status
Not open for further replies.

bluedollar

Programmer
Jul 24, 2003
174
GB
I have a text area on a form:

echo'<P>Overview:<br><textarea type=&quot;textarea&quot; rows=&quot;10&quot; cols=&quot;50&quot; name=&quot;overview&quot;>'.$result2.'</textarea>';

The info that the user enters I store in a MySQL database:

$SQL = &quot;update conference set overview = '$overview' where conf_id = '$id'&quot;;

This works fine, however when the user enters new lines in the text area these are not stored in the database. eg. user enters:

This is a test.

This is a test2.

Is stored as:

This is a test. This is a test2.

How do I represent the new lines in the database?

Any help would be greatly appreciated.

Thanks

Dan
 
Is HTML your user interface? If so, then the returns are probably stored -- it's just that a return in an HTML file doesn't start a new line. &quot;<br>&quot; does.

You can test this by placing &quot;<pre>...</pre>&quot; tags around the text. Inside a <pre> tag set, returns will start new lines.

You can also use your scripting language to replace all returns with &quot;<br>&quot;, either before inserting the text or after retrieval and before display.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top