Osagui Aghedo
Osagui Aghedo

Reputation: 350

How to pass more than 1 php variable in a facebook button link (like button)

I am currently developing a websie and a I have include in the news section one like button for each news I post there. Generating the url for the like button is not a problem. Here is the code I use:

<iframe src=\"//www.facebook.com/plugins/like.php?href=".$url."&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height:21px;\" allowTransparency=\"true\"></iframe>

and this id the is the $url:

$url = 'http://www.example.com/news/displayNews.php?title='.$display['title'].'&news_id='.$display['news_id'];

everything seem to work propely. Then I go to Facebook and the link for the news is posted there, but here is where the problem is. When i check the link posted in facebook it only has the first variable "title", the second one "news_id" is not there. So that's my question: How can i pass the two variables???

Pd: I tried interchanging the order of the variables, tried using "&" instead of "&". Searched the internet and didn't find a solution.

Upvotes: 0

Views: 691

Answers (1)

Kokers
Kokers

Reputation: 1828

try this:

http://www.example.com/news/displayNews.php?title='.$display['title'].'&amp;news_id='.$display['news_id']

use & amp; not &

or this because i see that youre using iframe:

http%3A%2F%2Fwww.example.com%2Fnews%2FdisplayNews.php%3Ftitle%3D'.$display['title'].'%26news_id%3D'.$display['news_id']

this kind of link is prepare at developer facebook. if they prepare link like this, than it should work

Upvotes: 1

Related Questions