Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ASP Database Output.. as HTML not Text?

    Hello,

    My level of .asp knowledge isn't the best, but I try!

    I have a database, I am simply writing the data from the database to a page, more or less. The problem is, some of the data contains asp tags. This code *should* all work fine. My problem is, its writing the asp code as if it were text. I have the database type set to text (not sure if that has anythign to do with it), but essentially i need it to be wrote as html. Do i need to do something with html encodes? I have used those with forms before, but its been awhile.

    A sample of how my code looks like this:
    Category: <% if request("category") <> "" then response.write request("category") & " "%>

    It should look like:
    Category: Blah

    Thanks a lot! I really appreciate it!!

  • #2
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You cannot output ASP code. You can output it as text or HTML.

    Use Server.HTMLEncode

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    A sample of how my code looks like this:
    Category: <% if request("category") <> "" then response.write request("category") & " "%>

    It should look like:
    Category: Blah
    Cannot be done. All you have there is text data, it will not process the ASP code.

  • #4
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So what does one do when you need to have asp within a database record... I have a similar problem I am facing.... which I have tried many work arounds that end up not working for some other reason in the end (EG: iFrames wont print data unless you focus on them, and cant focus on more then 1 iframe)
    So what is the solution ?

    And yes I do understand the difference between client and server side... but this is a problem my newb butt just can't seem to find a good solution too.

  • #5
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could try Executing the string
    http://www.4guysfromrolla.com/webtech/030300-1.shtml

  • #6
    Regular Coder
    Join Date
    Jan 2005
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by design1
    Category: <% if request("category") <> "" then response.write request("category") & " "%>

    It should look like:
    Category: Blah

    Thanks a lot! I really appreciate it!!
    I know I'm a little late for this, but whay are you checking to see if it's blank ... just do the following:
    Category: <%=request("category")%>

    if it's blank ... nothing will print to the page.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •