Mail to friend - link in body problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aft3rm4th
Forum Newbie
Posts: 8
Joined: Sun Sep 26, 2004 5:00 pm
Location: Polokwane, South Africa

Mail to friend - link in body problem

Post by aft3rm4th »

I have the following link in a "Mail this article to a friend" script:

Code: Select all

$mail_link = 'mailto:?subject=' . sprintf(_ARTICLE_SUBJECT, $sitename) . '&body=' . sprintf(_INT_ART_FOUND, $sitename) . ': ' . SITE_URL . '/modules/' . getModuleDirectory() . '/article.php?site_id=' . $site_id . '&story_id=' . $story_id;
In the "body=" part of the link, the link is only displayed up to $site_id. Everything after that starting with the ampersand (&) is excluded. I have tried simply using "&" instead of "&" but no change. What can I do to have it recognise the entire link? I need both the $site_id and $story_id variables in the link!

Regards
aft3rm4th :twisted:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you're trying to pack a url into an existing url.. you need to use rawurlencode() on the "body" content.
aft3rm4th
Forum Newbie
Posts: 8
Joined: Sun Sep 26, 2004 5:00 pm
Location: Polokwane, South Africa

Post by aft3rm4th »

Ah hah!

Thanks for the pointer! :)
Post Reply