Re: MySQL field to maintain formatting
| From: | Jason Sheets | Date: | Tue, 07 Jan 2003 03:20:22 +0000 |
| Subject: | Re: MySQL field to maintain formatting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130527@lists.php.net to get a copy of this message | ||
Assuming you are using a <textarea></textarea> to allow your users to
input their text you need to either use the nl2br (converts new lines to
<br>) or use <pre></pre> tags, following are short examples:
print nl2br($data); or
print '<pre>';
print $data
print '</pre>';
You can find out more about the nl2br function at
http://www.php.net/manual, if you allow users to enter
<b> tags then
they should show up using method.
Jason
On Mon, 2003-01-06 at 19:34, Vernon wrote:
> I'm having users post messages to a MySQL database records and want to
> retain the formatting (such as carriage returns and so forth).
>
> I have everything actually working all except that the formatting. Messages
> are being posted but when they are returned they lack the carriage returns.
> I'd like to be able to make characters bold and so forth, but would settle
> for the carriage returns if the rest is too difficult.
>
> Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php