This is what I usually do..
In the file you use to update the content for the page
(I'm assuming it's a file with a textarea box on it)
I have this function:
//-----
function htmlchars2txt($text) {
$text = ereg_replace("&(quot|#34);","\"",$text);
$text = ereg_replace("&(amp|#38);","&",$text);
$text = ereg_replace("&(lt|#60);","<",$text);
$text = ereg_replace("&(gt|#62);",">",$text);
$text = ereg_replace("&(nbsp|#160);"," ",$text);
$text = ereg_replace("&(iexcl|#161);",161,$text);
$text = ereg_replace("&(cent|#162);",162,$text);
$text = ereg_replace("&(pound|#163);",163,$text);
$text = ereg_replace("&(copy|#169);",169,$text);
$text = ereg_replace("&(#039);","'",$text);
$text = ereg_replace("<br>|<br />","",$text);
//$text = ereg_replace("?([0-9]{1,3});","\\1",$text);
//$text = preg_replace("/?([0-9]{1,3});/e","chr('\\1')",$text);
//Same as above line.
return $text;
}
//----
When the form is submitted, I then run the textarea variable though
these two PHP functions before putting in my SQL statement..
$textarea=nl2br(htmlspecialchars($textarea))
When I load the page with the textarea box on it, I then run the
blob field I pull from the database though the 'htmlchars2txt' function:
$body=htmlchars2txt($body);
then I populate the textarea like so:
<textarea><%print($body)%></textarea>
Then on the HTML page, you just output the blob file like so:
<%print($textarea)%>
PS: I have ASP tags turned on, on my server.
---------------------
Johnny Withers
[EMAIL PROTECTED]
p. 601.853.0211
c. 601.209.4985
-----Original Message-----
From: Julio [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 26, 2002 10:33 AM
To: [EMAIL PROTECTED]
Subject: help | i'm new
hi. i'm a dumb newbie. excuse my ignorance.
i'm using a <blob> field to store content for a webpage. The problem i
have
is that i enter text into the field in a formatted way (with line
breaks,
etc) and when i pull it back out into the PHP page from a query it gets
rid
of all the
line breaks and paragraph breaks i had. now, i know that this is
because i
didn't store the HTML formatted code, but i'd like to know how to insert
formatted content into a database and print it back on a page. i'm
using
Dreamweaver Ultradev 4, btw.
thanks!
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php