#1
  1. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jan 2014
    Posts
    69
    Rep Power
    5

    HTML in database issue


    Hi guys

    I dearly hope this is something you can help me with.

    On my website I have a form (page1.asp) that allows my users to format their text with HTML code and add it to my database (SQL Server). To do this I use a tool developed by Nicedit.com. If youíre not familiar with Nicedit it basically transforms a standard <textarea> box into a HTML editor where you can format text with html tags.

    An example of the data that is stored in my database table can be seen below:

    -------------------
    <h1 class="clear" itemprop="headline">Alan Pardew fires warning message to Manchester United ahead of crucial clash</h1><p class="lead">ALAN PARDEW insists he will not field a weakened side at Old Trafford tomorrow night.<br></p>
    -------------------

    This works fine and my users can add their html code to my database table. I then query the data and display it on another asp page (page2.asp).

    The problem I have is this, when my other asp page (page2.asp) displays my userís HTML formatted text the HTML code, that is retrieved from the database table, itself is rendered and used by my actual page so any code that my users use can actually effect my entire page. So, if a tag is broken then it could potential corrupt the entire look of my page.

    Ideally, I just want their HTML code to effect their text and not the other text or HTML elements on my page.

    Is this possible? Any help would be fully appreciated.

    Best regards

    Rod from the UK
  2. #2
  3. Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    May 2004
    Location
    UAE- Abu Dhabi
    Posts
    80
    Rep Power
    57
    Hi rjoseph244510,
    Im not sure if im getting your issue correctly ...anyway I always recommend to use and HTML Editor whenever there is an "HTML" data input.
    you can take look in google there is a lot of free HTML editor (build using JavaScript or Jquery) where you can easily add them to your source code.

    hope this help .
    Life is Simple, you make choices and don't look back


    My Websites :
    http://www.netomind.com
    https://www.facebook.com/Netomind
  4. #3
  5. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jan 2014
    Posts
    69
    Rep Power
    5
    Hi abd_10

    Thanks for your response.

    Nicedit is a HTML editor which I am using. However, the problem I have is this, when I display my user’s HTML formatted text the HTML code, that is retrieved from the database table, itself is rendered and used by my actual page so any code that my users use can actually effect my entire page. So, if a tag is broken then it could potential corrupt the entire look of my page.

    I think BBCode might be an alternative?

    Regards

    Rod from the UK
  6. #4
  7. Guru
    ASP Adventurer (500 - 999 posts)

    Join Date
    May 2003
    Location
    USA
    Posts
    925
    Rep Power
    80
    I suppose you could optionally give people just a few choices to do it themselves if they don't want everything as one long paragraph. Perhaps something like this:

    In the Body below you can use HTML tags such as:
    Bold: <b>Bold here</b>
    Italics: <i>Italics here</i>
    Bold Italics: <b><i>Bold italics here</i></b>
    Center Bold: <center><b>This Line Would be Centered and Bold</center></b>
    Link: <b><a href="http://www.thesite.com" target="_blank">The Site</a></b>
    New Line: And it's good to put <br><br> at the end of every paragraph.
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips
  8. #5
  9. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jan 2014
    Posts
    69
    Rep Power
    5
    Thanks Paul

    Best regards

    Rod from the UK

Similar Threads

  1. HTML to Database
    By digitaldxb in forum .NET Development
    Replies: 1
    Last Post: April 23rd, 2009, 01:58 PM
  2. Tricky issue / question about HTML output
    By roel018 in forum ASP Development
    Replies: 6
    Last Post: December 1st, 2006, 05:42 AM
  3. Saving html and asp in database and then using it
    By zippingnat in forum ASP Development
    Replies: 2
    Last Post: September 5th, 2006, 02:39 AM
  4. Get html into and out of a database
    By GregD in forum .NET Development
    Replies: 3
    Last Post: June 30th, 2004, 10:53 AM
  5. ASP database to html table
    By Steve Schofield in forum ASP Development
    Replies: 0
    Last Post: July 11th, 2000, 10:50 AM

IMN logo majestic logo threadwatch logo seochat tools logo