Okay I have a textarea that edits a text div.
When the user edits the text and submits,
paragraphs and line breaks are passed to the div.
i.e (not the browser)text div after submit....
'WARNING - This email and any attachments may be private & confidential.
If received in error, please delete and inform us by return email.'
textarea after submit....
'WARNING - This email and any attachments may be private & confidential. If received in error, please delete and inform us by return email.'
So the question is how can I get those paragraphs and breaks stored
and retrieved from a Mysql database, when using strip tags?
snippet that makes html tags for new lines..
$text = $row['text'];
$headline = $row['headline'];
// Use \n for newline on all systems
$text = preg_replace("/(\r\n|\n|\r)/", "\n", $text);
// Only allow two newlines in a row.
$text = preg_replace("/\n\n+/", "\n\n", $text);
// Put <p>..</p> around paragraphs
$text = preg_replace('/\n?(.+?)(\n\n|\z)/s', "<p>$1</p>", $text);
// Convert newlines not preceded by </p> to a <br /> tag
$text = preg_replace('|(?<!</p>)\s*\n|', "<br />", $text);
snippet that echos database info and strips the html
<textarea rows="10" cols="50" name="text">
<?php
echo strip_tags($text);
?>
</textarea>
how the info is updated....
$self = $_SERVER['PHP_SELF'];
if ($_POST['text_id']) { $text_id=$_POST['text_id']; }
if ($_POST['headline']) { $headline=$_POST['headline']; }
if ($_POST['text']) { $text=$_POST['text']; }
$tbl_name = "text_boxes";
$text_id = "27";
if ($logged_in=='true'){
$sql="UPDATE $tbl_name SET headline ='".$headline."', text='".$text."' WHERE text_id = '".$text_id."'";
$result=mysql_query($sql);
Any Ideas? H :^)