使用url参数发布到twitter

I have created a charity site for a cycle ride and when someone signs up for the ride I want to post to facebook twitter etc. Got the facebook working simply by making a share button, but having a slight issue with the twitter one

the link that I want to send to twitter has a '&' in it so that the user is directed to the sponsership page of the twitter post, but the twitter link strips out everything after the '&'

http://twitter.com/home?status=Sponser Me Please+http://www.*.co.uk/index.php?mode=sponser&id=$id"

I have stripped out the url of the site as I have not secured it fully yet and gone live.&

How do I get the '&id=' in the twitter feed

Thanks in advance Barry

You need to encode the URL properly

http://twitter.com/home?status=Sponser+Me+Please%2Bhttp%3A%2F%2Fwww.%2A.co.uk%2Findex.php%3Fmode%3Dsponser%26id%3D%24id

Sample Code:

echo "<a href=\"http://twitter.com/home?status=" . urlencode('Sponser Me Please+http://www.*.co.uk/index.php?mode=sponser&id=$id') . "\"> Twitter Status </a>";

& has special meaning in a query string (it indicates the start of the next key-value pair).

Use urlencode to escape the data.