[thelist] PHP: How to detect a line break in a textfield
Chris Marsh
chris at ecleanuk.com
Tue Feb 25 09:39:01 CST 2003
> > sText = Request.Form("Text")
> > sText = Replace(sText, vbCrLf, "<br />")
> >
> > Or:
> >
> > sText = Replace(sText, vbCrLf & vbCrLf, "</p>" & vbCrLf &
> "<p>") sText
> > = Replace(sText, vbCrLf, "<br />" & vbCrLf) sText = "<p>" &
> vbCrLf &
> > sText & vbCrLf & "</p>" & vbCrLf
>
> Chris,
>
> If the user is allowed to enter simple HTML in the text area,
> such as ordered-lists, how could you adapt this strategy to
> not insert <br /> between list elements?
There is a flag somewhere; let's say a database for the sake of
argument.
If isHTML = False Then
sText = Replace(sText, "<", "<")
sText = Replace(sText, ">", ">")
sText = Replace(sText, vbCrLf & vbCrLf, "</p><p>")
sText = Replace(sText, vbCrLf, "<br />")
sText = "<p>" & sText & "</p>"
End If
Response.Write sText
HTH
Regards
Chris Marsh
More information about the thelist
mailing list