Jump to content


Photo

Cant figure out how to remove characters


  • Please log in to reply
2 replies to this topic

#1 dizel247

dizel247
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 09 June 2006 - 06:46 PM

Hello,

I have a code that user selects using checkboxes email addresses and sends email. My problem with the code is that I always need to delete last _; from the end of the string, otherwise email gives error.

Code:

<?php
if ($cbox=$_POST['cbox']){
foreach ($cbox as $key => $eemail )
echo "$eemail; ";
}
?>

Result I get:
a@aol.com; b@aol.com; c@aol.com;

Result I need is:
a@aol.com; b@aol.com; c@aol.com
(;_)<<<<< this needs to be removed.

How can I implement a code that will do it automatically?

Thanks in advance,

Roman K


#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 09 June 2006 - 06:48 PM

Use implode() instead:
[a href=\"http://www.php.net/implode\" target=\"_blank\"]http://www.php.net/implode[/a]

implode('; ', $_POST['cbox']);

~ D Kuang

#3 dizel247

dizel247
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 09 June 2006 - 07:28 PM

[!--quoteo(post=381996:date=Jun 9 2006, 02:48 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 02:48 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Use implode() instead:
[a href=\"http://www.php.net/implode\" target=\"_blank\"]http://www.php.net/implode[/a]

implode('; ', $_POST['cbox']);
[/quote]


wow,

thanks for a quick reply. That did a trick.

Roman




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users