jarvis Posted March 1, 2010 Share Posted March 1, 2010 Hi All, I've the following code: foreach ($subscribers as $record) { $from = "[email protected]"; $to = $record['email']; $subject = "Article Added to the ". $clientName . " client"; $message = "A new article entitled '". @$_REQUEST['title'] . "' has been added to the {$clientName} client"; $message .= "\n". @$_REQUEST['summary'] ."\n\n"; $message .= "\nClick here to to view it: http://www.domain.com/news.php?". @$_REQUEST['title'] ."-". $num; It works but if the title has spaces in, the link in the email fails. How can I replace the title with -? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/193749-email-issue-replace-spaces-with/ Share on other sites More sharing options...
inversesoft123 Posted March 1, 2010 Share Posted March 1, 2010 $title = str_replace(" ","-",$title); Quote Link to comment https://forums.phpfreaks.com/topic/193749-email-issue-replace-spaces-with/#findComment-1019771 Share on other sites More sharing options...
jarvis Posted March 1, 2010 Author Share Posted March 1, 2010 Thanks inversesoft123 , I'd come across that piece of code, however, couldn't see how to tie it in with my code. Quote Link to comment https://forums.phpfreaks.com/topic/193749-email-issue-replace-spaces-with/#findComment-1019778 Share on other sites More sharing options...
inversesoft123 Posted March 1, 2010 Share Posted March 1, 2010 I understand that you are asking how to use this in your code. If I am correct then $title = $_REQUEST['title']; $title = str_replace(" ","-",$title); or $title = str_replace(" ","-",$_REQUEST['title']); May help you Quote Link to comment https://forums.phpfreaks.com/topic/193749-email-issue-replace-spaces-with/#findComment-1019781 Share on other sites More sharing options...
jarvis Posted March 1, 2010 Author Share Posted March 1, 2010 Thanks I'll play around with that! Quote Link to comment https://forums.phpfreaks.com/topic/193749-email-issue-replace-spaces-with/#findComment-1019791 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.