premiso Posted February 18, 2009 Share Posted February 18, 2009 Yes, you do. <form action="search.php" method="post"> <br /> Enter Name:<br /> <input name="name" type="text" size="40"/> <br /> And Or Enter Interests:<Br /> <input name="interests" type="text" size="40"/> <br /> <input type="submit" name="submit" value="search"/> </form> Try that and see where it get's you. EDIT: A side note for why none of the other guy's solutions worked. Your form was passing "Friendsearch" and you were checking for "name" in your script. Since they are not the same, that is why your original did not work. It was always checking if name was = "" (or nothing). Since that was never being populated with data due to the inconsistencies of the names. Just remember $_POST['index'] must correspond directly with your form input field names, or else it will not work/return nothing. Quote Link to comment https://forums.phpfreaks.com/topic/145756-php-search-for-friends-problem/page/3/#findComment-765456 Share on other sites More sharing options...
chrisC Posted February 18, 2009 Author Share Posted February 18, 2009 ok, so the only trouble is, it will only find peoples interest if theres more than one person with the same?? does that make sence? Also how can I get so that I can search for Name, Username dob Interests Also another issue is when you only type in chris or any name it comes up with all the details fo everyone on the database Quote Link to comment https://forums.phpfreaks.com/topic/145756-php-search-for-friends-problem/page/3/#findComment-765468 Share on other sites More sharing options...
premiso Posted February 18, 2009 Share Posted February 18, 2009 ok, so the only trouble is, it will only find peoples interest if theres more than one person with the same?? does that make sence? Also how can I get so that I can search for Name, Username dob Interests Also another issue is when you only type in chris or any name it comes up with all the details fo everyone on the database Use AND instead of OR in the implode function to limit that. If you typed in "chris" and someone has a name of "christopher" it would find it given the "LIKE" clause. I am not sure what your database consists of. To add dob and username simply follow the scheme I setup for the "name" and "interests" on the php side. The OR keyword in MySQL says, Either This or This or This, where as and would be his name is this AND interests have to be this AND dob has to be this. Quote Link to comment https://forums.phpfreaks.com/topic/145756-php-search-for-friends-problem/page/3/#findComment-765471 Share on other sites More sharing options...
chrisC Posted February 19, 2009 Author Share Posted February 19, 2009 hi guys, had to leave yesterday, currently dont understand what im doing wrong with respects to gettin correct search results Currently I can type anyones name and get results for everybody, i want it so i can just get search results for the name and interest entered any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/145756-php-search-for-friends-problem/page/3/#findComment-766038 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.