Page 1 of 1

Problem with explode() and post data

Posted: Thu Oct 24, 2002 9:09 pm
by RandomEngy
Hey, havn't been around in a few months with school and all, but I'm finally doing a bit more work on my database.

Anyway, I'm having some frustrating trouble dealing with some form data. Basically, I have a textarea on an input page, and I want the format to be:

Code: Select all

Item1
Item2
Item3
when they enter information. On the recieving end I do a

Code: Select all

$list_array=explode("\n",$_POSTї'stuff']);
to try to get all of the items. The problem is, each array string entry (except the last) has an extra \n at the end of it, which I've verified with a var_dump, and echoing each entry out. This doesn't happen when I manually enter a string like "Item1\nItem2\nItem3". I don't want those newlines there. I know I could always do a str_replace and get rid of them, but I'd really like to know what's going on.

Posted: Fri Oct 25, 2002 10:26 am
by RandomEngy
Excellent, I just have to explode with "\r\n" instead of just "\n" .