0

I have the below code as part of php includes on my webpage. The code simply opens the fb page in a new window and share the page url.

The page url is currently static but i need to dynamically update it depending on the page its called upon.
facebook share

I tried -- echo "$_SERVER['REQUEST_URI']"; see code below but didnt work.

<a href="https://www.facebook.com/sharer/sharer.php?u=http://bigbenfitness.in<?php echo "$_SERVER['REQUEST_URI']"?>" onclick="window.open(this.href,'targetWindow', 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=500px, height=500px'); return false;" class="sprite facebook-45px"><span class="hidden">facebook share</span></a>

I'm not sure how to do this in javascript.

Benny Thadikaran
  • 1,101
  • 1
  • 8
  • 15
  • 2
    what is the error you get? Or what is the result in your sourcecode of your website? I think it should be without "" – Andre Nov 25 '16 at 13:29
  • yes its working correctly now! Thanks. There were no errors in the console but the nothing below the div section was displaying. I guess its was a syntax error like you pointed. – Benny Thadikaran Nov 25 '16 at 13:34
  • Click this link.. Sure you can find your solution...http://stackoverflow.com/questions/1283327/how-to-get-url-of-current-page-in-php – Pravin Vavadiya Nov 25 '16 at 13:47

0 Answers0