在网址中包含人名和姓氏,与空间作斗争

I'm pretty new to this and need a hand I'm trying to send out personalised greetings. My code works perfectly as long as the names of the sender and beneficiary are limited to their first names. As soon as I input their last names the URL doesn't include it, I'm guessing that the issue is because of the space between their first and last names. The php data comes from an input on my website

here is a sample of my code

<p>Dear <?php echo stripslashes($item -> iof_benname); ?></p>
<p></p>
<p>A donation has been made in your honour by: <?php echo stripslashes($item -> iof_name); ?></p>
<p></p>

 <p>Please <a href=http://myym.co.za/wp-content/uploads/2014/09/IHO.php?NAME=<?php echo stripslashes($item -> iof_name)?>&BNAME=<?php echo stripslashes($item -> iof_benname) >>click here</a> to view your message.</p> 

First, sanitization should be handled with htmlspecialchars, not stripslashes.

Second, parameters in URLs like that should be escaped with urlencode.