Jump to content

Recommended Posts

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

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 :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.