Help needed stripping spaces between HTML tags!

Results 1 to 3 of 3

Thread: Help needed stripping spaces between HTML tags!

  1. #1
    JuDDer Guest

    Default Help needed stripping spaces between HTML tags!

    Hi Everyone,<BR><BR>I&#039;m building a classified ads site and I want to allow users to type either test ads, or html ads.<BR><BR>My problem is with inserting the contents of a form element into the database if HTML has been entered.<BR>If a user copies and pastes html out of their webpage, then it is usually in a similar format to this:-<BR><BR>&#060;html&#062;<BR>&#060;head&#062;<BR>&# 060;title&#062; My Title &#060;/title&#062;<BR>&#060;body&#062; etc, etc.......<BR><BR>What I need to do is strip out all the spaces and line breaks between the &#062; closing tag for the first part of html, and the &#060; tag from the next piece of html.<BR><BR>What I need to be left with is something like this:-<BR><BR>&#060;html&#062;&#060;head&#062;&#060;titl e&#062; My Title &#060;/title&#062;&#060;body&#062; blah blah...<BR><BR>So then everything is one continuous line.<BR><BR>Please can someone advise me on the best way to do this as I&#039;ve been trying for ages and cant get it right!<BR><BR>Thanks!

  2. #2
    Join Date
    Dec 1969

    Default RE: Help needed stripping spaces between HTML tags

    Why do you need it in one line? Why would you want to insert an HTML page into a db? Why not save it as a txt file or as an HTML page and store the url in the db. Much smaller db and easier access.

  3. #3
    Join Date
    Dec 1969

    Default This should do it.

    Try this:<BR>1. Put all your html into a variable, like strHTML for example.<BR>2. Then, strHTML = replace(strHTML,vbCrLf,"")<BR><BR>That second line should replace all the "returns" with nothing. The vbCrLf represents the returns.

Posting Permissions

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