Adam H-W
The following fuction will do this and more, it's a fairly self expalnatory and VERY useful function. I run this function on every free text area form element value when inserting or updating. (Dont forget the old trim function also)
Place the following code in a functions.inc file (no need to put it on every page):
-----------cut n paste-------------
Function StoreText(theText)
StoreText = ""
on error resume next
StoreText = CStr(theText)
if (len(StoreText) > 0) Then
StoreText = Replace(StoreText, """", """, 1, -1, 1)
StoreText = Replace(StoreText, "'", "''", 1, -1, 1)
StoreText = Replace(StoreText, vbCrLf, "<BR>", 1, -1, 1)
end if
End Function
--------------end ------------------
Put this in the head of every page that uses the function
-----------cun n paste--------------
-----------finish-------------------
Now when inserting a value that may have a <br> or " or '
'" & trim(storeText(request.form("fieldname"))) & "'
Dont be afraid to run it on every form variable where there may possibly be one of these characters, users will do what we least expect.
Wind is your friend
Matt
|