RE: [PHP] array_search
| From: | Jake McHenry | Date: | Thu, 20 Nov 2003 20:02:04 +0000 |
| Subject: | RE: [PHP] array_search | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170488@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Jake McHenry [mailto:linux@nittanytravel.com]
> Sent: Thursday, November 20, 2003 2:51 PM
> To: 'Jay Blanchard'
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] array_search
>
>
> > -----Original Message-----
> > From: Jay Blanchard [mailto:jay.blanchard@niicommunications.com]
> > Sent: Thursday, November 20, 2003 2:48 PM
> > To: Jake McHenry; php-general@lists.php.net
> > Subject: RE: [PHP] array_search
> >
> >
> > [snip]
> > I've been using array_search in my scripts for a while now,
> > but have come across a problem. My new page has a textarea
> > field. If I enter any new lines in the textarea, array_search
> > returns false.
> >
> > I have tried using html_encode, addslashes, serialize and
> > nothing yet has worked. My only other options that I can
> > think of would be to limit the textarea to one line (change
> > it to a regular text input
> > field) or do a regex on the posted data and replace the line
> > returns with something else (which I have tried without
> > success). [/snip]
> >
> > Just a SWAG, but you are exploding the textarea into an array
> > using spaces for the explosion? If so use a replace function
> > to replace the \n characters, then do your thing...following
> > is untested...
> >
> > $foo = $_POST['textarea'];
> > $newFoo = str_replace("\n", " ", $foo);
> > $arrayFoo = explode(" ", $newFoo);
> >
>
>
> No, I wasn't doing this. I will try it though.
>
>
>
> Thanks,
>
> Jake McHenry
> Nittany Travel MIS Coordinator
> http://www.nittanytravel.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
I had to change it from \n to \r\n, but this really has no usefullness
over just changing the textarea into a regular text input field.
Just to keep things simple, I think this is what I'm going to do.
Thanks for the info
Thanks,
Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com