|
-
Apr 1st, 2003, 06:34 PM
#1
Thread Starter
Addicted Member
Help with reading HTML code from a database
I have an access database that contains HTML code, this code is read into a textarea object that is on my page, however if this code in the database contains for example "& q u o t;" it gets converted into its appropriate HTML syntax when its read into the textarea, and then when the user clicks "Update" the database is updated with the wrong information, how can I prevent this from happening?
This is very hard to explain so please say if you dont understand...
Last edited by Neilbaker86; Apr 1st, 2003 at 06:41 PM.
-
Apr 1st, 2003, 06:54 PM
#2
Frenzied Member
use Replace() function to avoid this problem
Code:
strData=replace(request.form("YourTextAreaName"),""", """)
see what i mean
-
Apr 2nd, 2003, 02:28 AM
#3
Lively Member
On that note, I would like to add a question...
What if you have a MS database that contains a Memo datatype with HTML syntax in it ie <br> and you want to load that into a textarea. It shouldn't be converted into " (or whatever the syntax is for < and >, I can't remember).
The text in the database should be loaded into a textarea exactly as it is written in the database!!
Enjoy...
----
If something is hard to do then it aint worth doing!!
-
Apr 2nd, 2003, 05:36 AM
#4
Thread Starter
Addicted Member
Yeh, a <br> would still be in text form but if you have the code way to display the "code" like the "& l t ;" it gets converted to its appropriate symbol when its loaded into the textarea. which i want it to stay as "& l t ;".
Last edited by Neilbaker86; Apr 2nd, 2003 at 05:42 AM.
-
Apr 2nd, 2003, 06:36 AM
#5
Hyperactive Member
Use server.HTMLEncode :
Code:
<textarea cols="35" rows="10">
<%
Response.Write "<a href=&qu ot;page.asp&qu ot;>click</a>" & vbCrLf
Response.Write server.htmlencode("<a href=&qu ot;page.asp&qu ot;>click</a>")
%>
</textarea>
remember to remove the [spaces] out of the &qu ot; in the examples above!
---
Anglo Saxon
-
Apr 3rd, 2003, 06:19 AM
#6
Thread Starter
Addicted Member
Cheers!
Thanks Anglo Saxon it works a treat now!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|