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 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); 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. 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 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! 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
Archived
This topic is now archived and is closed to further replies.