OK I have posted two other topics about these darn <br> Here and Here I got the form to stop putting in a new
at teh beginning and end of text in the text areas with the following code
function fromhtml ($x) {
$x = preg_replace("/<p>/i","\n\n",$x);
$x = preg_replace("/^<br(\/|)>/i","\n",$x);
//$x = preg_replace('#^<br(\/|)>+|<br(\/|)>+$#i', "\n", $x);
$x= preg_replace("/(^)?(<br\s*\/?>\s*)+$/","\n", $x);
$x = preg_replace("/<li>/i","\n<li>",$x);
return $x;
}
Now the problem I am having is that on fields that are left empty a <br> gets inserted into the field on submission. It doesn’t repeat but that one <br> can be a problem on some fields as there is a conditional statement about printing that field on another page. any help would be appreciated.
EDITED to add the conditional statement from the other page
if ($prerequisites != "") {
print " <b>Prerequisites:</b> ".link_course($prerequisites);
}
Just simply check if the string is a br, and if so replace it with ”