HI everyone, I have a script running on a website that uses the facebook share.php file.

<?php
                    $title=urlencode(''.$numrows['title'].' | '. htmlentities(money_format("%10.2n", $numrows[price])).' '.$currency_code.'');
                    $url=urlencode(''.$token.'');
                    $summary=urlencode(''.$numrows['description'].'');
                    $image=urlencode(''.$numrows['img1'].'');
                ?>
                <a id="button" onClick="window.open('http://www.facebook.com/sharer.php?s=100&amp;p[title]=<?php echo $title;?>&amp;p[summary]=<?php echo $summary;?>&amp;p[url]=<?php echo $url; ?>&amp;&p[images][0]=<?php echo $image;?>', 'sharer', 'toolbar=0,status=0,width=550,height=400');" target="_parent" href="javascript: void(0)">
                    <input type='submit' class='btn' title='Share This Item With Friends' value='Share On Facebook'></form>    
                </a>  


            <?php

Now I have the currency symbol displaying correctly when the page is loaded. Now I am trying to display the currency symbol from within the code I get the html code = &pound; being displayed infront of the price.

I have tried it with money_format("%10.2n", $numrows[price]) but that doesnt work.

Any ideas why or how I can get this to work and display the currency symbol correctly

I don't know if this will help you in any way but this is my simple solution or ideea
If you work with a database and have stored in a database a row of curency for each product you can do a

foreach(product as key=>value){
//print them all

}


   $title=urlencode(''.$numrows['title'].' | '. htmlentities(/*just use a string like         this*/ '&pound', $numrows[price])).' '.$currency_code.'');

Hi thanks for your reply, but when I try that all I get is &amp;pound; being displayed.

This would not work anyway, how would I get around the problem if a currency symbol was anythink other than a UK £

Maybe the problem is due to having to use
urlencode ?

$title=urlencode(''.$numrows['title'].' | '. htmlentities(money_format("%10.2n", $numrows[price])).' '.$currency_code.'');
Member Avatar for diafol

Try:

echo html_entity_decode($currency_code);

BTW, to decode html encodeds, the ';' needs to be on the end of it, so &pound; as opposed to just &pound

Hi thanks for your reply - I am trying to get the currency symbol to display before the price variable

'. htmlentities(money_format("%10.2n", $numrows[price])).'

How do I add

html_entity_decode

to the above ?

I have tried

'. html_entity_decode(money_format("%10.2n", $numrows[price])).'

but I still get the following
�1.00

Member Avatar for diafol

This may be a UTF-8 issue. ENsure that you have everything encoded to utf-8. This often happens if you output php strings without/before a DTD/head with utf-8 settings.

Try putting this in the file: header('Content-Type: text/html; charset=utf-8');

DBs are also very prone to this sort of issue. If it may be DB related:

mysql_query(SET NAMES utf8); 
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.