Page 1 of 1

Mail to friend - link in body problem

Posted: Tue Mar 08, 2005 1:44 pm
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:

Posted: Tue Mar 08, 2005 1:47 pm
by feyd
you're trying to pack a url into an existing url.. you need to use rawurlencode() on the "body" content.

Posted: Tue Mar 08, 2005 2:04 pm
by aft3rm4th
Ah hah!

Thanks for the pointer! :)