Hi All,
please help, this is driving me mad! I'm a PHP Dummy and I've been looking for a solution to this all afternoon. I either couldn't find the answer or didn't understand - It's probably more likely the latter.

I have been building a new site in wordpress and I've implemented a bulk importing script which has worked very nicely in the past. The thing is that I now need to input some information in the input fields that are in their html entities.

This is what I'm trying to put in:

http://www.some.flv" rel="shadowbox;height=396;width=700" title="<a href="[url]http://www.thesiteyoucanvisit.com">Click[/url] Here to Visit this web site</a&gt

The script changes it to:
http://www.some.flv" rel="shadowbox;height=396;width=700" title="<a href="http://www.thesiteyoucanvisit.com">Click Here to Visit this web site</a&gt

as you can see, the script is puttin in the '<' and '>' and the " symbols instead of the '&lt' and '&gt' and &quot; HTML entities.

The input field in the script for this line is as follows:

value="<?php echo stripslashes(htmlspecialchars($embedTemp)); ?>"

I've tried all kinds of things, html_entity_decode, ENT_NOQUOTES, etc (probably not in the correct configuration by the way)

I can go into the database and change it to what I want and the script works fine until I update the template and POOF! it's back to putting the < " symbols in.

Please, please, please can anyone tell me what it is I need to put in the value field to stop this happening?

Thanks

    It's not at all clear what you're trying to do. It would be helpful if you posted the script and described a little more clearly what you are doing in terms of wordpress, where you are importing from, etc.

    Personally, I find it puzzling that you would put any HTML into a title attribute.

      Hey Sneakyimp,
      Thanks for the reply. The reason for putting the HTML entities in the title attribute is because I'm using ShadowboxJS, and it makes the title a link which validates - hence the need to stop the script I'm using from changing the input to just plain HTML.

      I simply wondered if there may be a simple line of code to replace with the code I mentioned, (stripslashes(htmlspecialchars) to stop the script from changing the input I want in the field. I've looked into the matter yet further and it does seem like the above code is the culprit - like I said, It's fine when I enter the input directly into the database.

      Thanks for the reply anyway

        htmlspecialchars will turn this:

        <href="foo.html">[code]
        
        into this:
        [code]&lt;href=&quot;foo.html&quot;&gt;

        That line of code you mentioned is not responsible for reversing the html entities. It's happening somewhere else -- possibly in wordpress?

          Write a Reply...