Page 1 of 1

Comparing not the exact of two values...

Posted: Thu Mar 09, 2006 11:04 pm
by JellyFish
I'm trying to do an if statement like this:

Code: Select all

if ($_POST['search'] == $search[$l]) {
The problem I'm having is spaces in my $_POST[search] are one problem what I mean when I say this is that the I'm trying to compare it with the $search (which is the keywords of each thing that my search engine is trying to search). I don't really know how to explain what I'm trying to explain so I'm just going to ask:

How would I make $_POST[search], when comparing it to $search, not compare the spaces and both $_POST and the $search strings.

I'll think about this more but I think I explained it good. :? Thanks for reading and all help is appreciated. :)

Posted: Thu Mar 09, 2006 11:28 pm
by feyd
remove the spaces? str_replace()

Posted: Fri Mar 10, 2006 12:47 am
by tmarion
trim() also works nicely, although it is just for the beginning and ending spaces.

www.marionweb.com
- Business solutions through technology.

Posted: Fri Mar 10, 2006 5:40 pm
by JellyFish
Yeah, this information works. I the like tirm function. It works nice and does do what I need.

Thanks for both of your post, any more posts are still exepted, if anyone has something they might want to add. :)