Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Multiple search on a single text file
Hello

I want to use a search engine based on text files and I found this one:
http://php.warpedweb.net/

I want to search with multiples criteria with text box,checkbox and
radio button.

Basically I already have this code:

function s_search($query) {
// Searches for query in the index file.
// Multiple word search originally contributed by Matthew Furister
<matt@agtown.com>

$query =  trim(strtolower(c_strip_chars($query)));

$search_data = @file($GLOBALS[index_file]) or die("<h4
align=\"center\">$GLOBALS[err_no_search_db]</h4>");
$pages_found = " ";
foreach ($search_data as $search_page) {
$page_arr = explode("|", $search_page);
$found_count = 0;
$qry_array = split('[, ]+',trim(strtolower($query)));
foreach ($qry_array as $qry) {
if (in_array($qry, $page_arr)) {
++$found_count;
$pages_found .= $page_arr[0] . " ";
}
}
if ($found_count == count($qry_array)) $result_arr[] = $page_arr[0];
}
return $result_arr;
}




with the form here:

function s_print_search_form($query) {
// Function to print the search form.
?>
<div align="center"><form method="post">
<h4>Search for:</h4>
<input type="text" name="query" value="<?php echo $query ?>">
<input type="checkbox" name="query" value="Training"> Training<br>

<br><input type="submit" value="Search">
</form></div>

In this example, the last criteria is taken but the first one is not.
I want to be able to have something like this:
search.php?query=phil&training

If you have any idea, I would be interested to hear it.

thanks.
--
Philippe Waterloos  | Web applications | www.soleica.ca
<http://www.soleica.ca>


Report this thread to moderator Post Follow-up to this message
Old Post
Philippe Waterloos
03-27-04 04:12 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 02:07 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.