hiii sir
i am trying to share my image form face book app from my app to facebook

the code for share button is follows

<button class="rounded" onClick="window.open('http://www.facebook.com/sharer.php?u=<?php echo $curimg?>','my window','width=550,height=450')" style="font-family:sans-serif;">
<span>SHARE</span>
</button>
i need to display the image instead of path thats present in $curimg pls help me
thanks in advance

    Hi amsimaganti!

    First of all you should learn why you can't simply write html code in PHP:

    If you have a var, f.e. $foo = ""; you can't just simply write $foo = " lorem"ip"sum" for example cause PHP in this case won't understand that the var should end at the end of this phrase, it thinks the variable ends at ...lorem" and that " lorem" is the whole string.

    So you have to encode the html string a bit with f.e. HTML numbers or ASCII Code.

    F.e. lets take <button class="rounded", this should be 'translated' into:

    &lt;button class=&lt;rounded&lt;, etc.

    Reference: http://www.ascii-code.com/

      <?php echo $curimg?>

      should be

      <?php echo $curimg; ?>

      you forgot a semi-colon.

        Ah 🙂 sorry 'bout that.. thought he had to output the whole html code.

        You can also write it like this <?=$curimg;?>..

          php short tags is deprecated and turn off by default on most servers, so its better to use the long version for better portability

            johanmichel;10983688 wrote:

            Hi amsimaganti!

            First of all you should learn why you can't simply write html code in PHP:

            If you have a var, f.e. $foo = ""; you can't just simply write $foo = " lorem"ip"sum" for example cause PHP in this case won't understand that the var should end at the end of this phrase, it thinks the variable ends at ...lorem" and that " lorem" is the whole string.

            So you have to encode the html string a bit with f.e. HTML numbers or ASCII Code.

            F.e. lets take <button class="rounded", this should be 'translated' into:

            &lt;button class=&lt;rounded&lt;, etc.

            Reference: http://www.ascii-code.com/[/QUO

            can u provide the code for passing an image url there so that i can get the image instead of image path
            if so i use echo statement and try to print the image tag unable to do so as it is already in double quotes

              Write a Reply...