I have a search page with three parameters....author, title and journal. I typed in "heart" in the title text area and hit the return button, thinking it would activate the search button. it merely did a carriage return in the text area, then I hit the submit button.
the result came back as null, as there is not title that has the word "heart" in it with a carriage return afterwards. if I take our the return, it finds the heart articles. I tried a similar thing in the author section, putting a space after the author name...same empty results. I would like to fix that. THANKS!! ----- Original Message ----- > What exactly are you trying to do? trim() only rmeoves whitespace from > the beginning and end of a string. It doesn't work on a record / array > and it doesn't pull all whitespace from the string. > > $str = ' whitespace before and after '; > $trimmedStr = trim($str); > $noWhitespaceStr = preg_replace('/\s/', '', $str); > > On Wed, 21 Jul 2004 13:54:22 -0400, melissa atchley > <[EMAIL PROTECTED]> wrote: > > thanks guys...but with all of the >>>> in the message, the syntax is not > > coming through. > > > > I have tried adding the trim() line in several ways and it isn't working. > > can you help me with the exact syntax? > > > > > > > > ----- Original Message ----- > > From: "Justin Patrin" <[EMAIL PROTECTED]> > > To: "John W. Holmes" <[EMAIL PROTECTED]> > > Cc: "msa" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Wednesday, July 21, 2004 1:12 PM > > Subject: Re: [PHP] trim() white space from record set > > > > > On Wed, 21 Jul 2004 12:41:55 -0400, John W. Holmes > > > <[EMAIL PROTECTED]> wrote: > > > > msa wrote: > > > > > > > > > I created a search form with multiple search parameters. It returns > > nothing > > > > > if there is a space after their text entry or if they hit return in > > the text > > > > > area. > > > > > > > > > > $coltitle_rsResults = "0"; > > > > > if (isset($_GET['Title'])) { > > > > $_GET['title'] = trim($_GET['title']); > > > > > $coltitle_rsResults = (get_magic_quotes_gpc()) ? $_GET['Title'] : > > > > > addslashes($_GET['Title']); > > > > > > > > > > where do i put the trim? > > > > > > > > See above. You have to assign the result of trim() to a variable. My > > > > crystal ball (it's back off of loan now) says that was the issue. :) > > > > > > > > > > Ugh....damn Perl and its auto-assign and $_ features. It makes people > > > assume things... > > > > > > > > > -- > > > DB_DataObject_FormBuilder - The database at your fingertips > > > http://pear.php.net/package/DB_DataObject_FormBuilder > > > > > > paperCrane --Justin Patrin-- > > > > > > !DSPAM:40feabc142245912817392! > > > > > > > -- > DB_DataObject_FormBuilder - The database at your fingertips > http://pear.php.net/package/DB_DataObject_FormBuilder > > paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php