php and searches?!?

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Post by Joan Garnet » Sun Jan 26, 2003 2:19 pm

A full sample:

Code: Select all

<HTML>
<HEAD>
<TITLE> Joan Garnet's javascript search </TITLE>
<script language="javascript" type="text/javascript">
//it works for both netscape4+ and ie4+ :)
//
function pageSearch(val) {
   var result = document.forms[0].elements[1].value.search(val);
   if (result != -1){
         alert ("the word was found!!");
      }else{
         alert ("the word couldn't be found... ");
   }
}
</script>
</HEAD>
<BODY>
<form onSubmit="javascript:pageSearch(document.forms[0].elements[0].value)">
Enter a word to be searched:<br>
<input type="text"><br>
Enter a text:<br>
<textarea rows=5 cols=25>
This a sample text
</textarea>
<input type="submit" value="search">
</form>
</BODY>
</HTML>

greg
New php-forum User
New php-forum User
Posts: 11
Joined: Wed Nov 13, 2002 6:56 am

Search

Post by greg » Sun Jan 26, 2003 8:08 pm

The javascript pageSearch(iVal) function is not called in the HTML page with the search form on the site for which you provided a link.

What they are doing is hidden by the fact that they are using PHP on the server side to process the form data and, of course, we can't see that. I would guess they are using a database. I didn't look at the site to try to figure out what the source of the info searched but I was guessing news items that they had posted previously.

What is it you want to search? User posts? Items you have previously displayed on your pages? You may be able to use a simple ASCII file(s) to hold the data you want searched.

Is there a set of functions within PHP that will index and search ASCII files without explicitly opening the file and reading the contents?

Sorry, I don't have an answer for you but I am prodding you for clarification to help someone provide an answer that I may be interested in.

bobaloo
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Feb 01, 2003 11:34 am

Post by bobaloo » Tue Feb 04, 2003 9:16 pm

I made a non-database PHP search engine for my site (that works quite nicely) with the wonderful get_meta_tags() function, and a while loop. But, I'm not gonna post it, sorry.

*JaH*
New php-forum User
New php-forum User
Posts: 80
Joined: Fri Jan 31, 2003 4:18 pm

Post by *JaH* » Fri Feb 14, 2003 4:33 pm

bobaloo wrote:I made a non-database PHP search engine for my site (that works quite nicely) with the wonderful get_meta_tags() function, and a while loop. But, I'm not gonna post it, sorry.


affraid we will steal it? ;) glad you found a way to write it :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests