467,926 Members | 1,741 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,926 developers. It's quick & easy.

trying to modify my search script

I am modifying a search script, but when I change it, it only searches for 2 of the 3 fields. I believe the problem is in a chunk of it here.
Expand|Select|Wrap|Line Numbers
  1. if( $INFO[0] eq "$FORM{title}" && $INFO[1] =~ /$FORM{subject}/ && $INFO[2] =~ /$FORM{search}/ ) {
it only searches for the title and the search is a text line. i need it to search for the title subject, and search categories.

How can i change this code so it searches for all 3?
Sep 10 '08 #1
  • viewed: 1055
Share:
4 Replies
numberwhun
Expert Mod 2GB
Why are you using "eq" for the first match, but regex's for the rest? Without seeing what its trying to match and the rest of the code, its going to be tough to help you.

Regards,

Jeff
Sep 10 '08 #2
eWish
Expert 512MB
Currently the way it is written, you must match on three occurrences before it will enter inside of the if statement. Would you rather search for a match on any of the three elements?

--Kevin
Sep 10 '08 #3
Currently the way it is written, you must match on three occurrences before it will enter inside of the if statement. Would you rather search for a match on any of the three elements?

--Kevin
ideally the script would search for any input given.
Sep 10 '08 #4
eWish
Expert 512MB
Then you would need to use the || in lieu of &&

Expand|Select|Wrap|Line Numbers
  1. if ($FORM[0] eq $title || 
  2.     $FORM[1] eq $subject || 
  3.     $FORM[2] eq $search) {
  4.  
  5. ....then do something here....
  6.  
  7. }
I hope that you are checking your data first. Never trust the user's input.

--Kevin
Sep 10 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by it hates me | last post: by
2 posts views Thread by Benjamin Rutt | last post: by
9 posts views Thread by Boris Yeltsin | last post: by
reply views Thread by Grant Schenck | last post: by
23 posts views Thread by no1zson | last post: by
6 posts views Thread by Doogie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.