Hi. I am parsing a form from a previous page. That page has a textarea where the user enters several email addresses, one per line. It is passed to page 2 by a POST.
I then break up the email addresses by using nl2br and then exploding it into an array using <br /> as the delimiter string. All works fine (I also keep the original version of the textarea contents just to be safe...)
Then I need to create a hidden form field in page 2 with a list of the email addresses, thus:
<input type="hidden" name="recipients" value="email1,email2,email3" />
(i.e. no breaks between addresses and/or commas)
I do this with a foreach loop on the array from the explode function. Each iteration does $list.=$element.",";
However when I view the resultant HTML source, there is a break between the email addresses, thus:
<input type="hidden" name="recipients" value="email1,
email2,
email3" />
I've tried str_replace with \n, \r, \n\r, chr(106), rtrim and everthing else I can think of but I can't get the line to concatenate without a break.
I've also tried using the original textarea contents and doing the above operations in case it's being added by the foreach loop or the array elements, but the results are the same - line breaks.
I would be REALLY grateful for any help! This is driving me crazy.
Thanks
===Toby Wallis===