urlencoding of the_title() doesn’t work?

hey guys,
<?php urlencode(the_title()); ?>doesn’t take effect.

this is my entrie line of code:

Read More

<li><a href="mailto:?subject=<?php urlencode(the_title()); ?>&amp;body=<?php the_permalink(); ?>">e-mail</a></li>

I don’t want to have spaces in the_title(). Why does urlencode not work for me?

Related posts

Leave a Reply

1 comment

  1. The the_title() echo the title. You must use get_the_title() instead. get_the_title() returns the title as string. Use

    <? echo urlencode(get_the_title()) ?>