Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

php and searches?!?

General discussions related to php

Moderators: macek, egami, gesf

php and searches?!?

Postby ericehle » Thu Jan 23, 2003 10:53 pm

I was looking at http://www.designiskinky.com , and I was trying to create a search similar to what they did on their news search, althought I am not able to use mysql on my webserver(so I am told but can use php). Any info on how they did this or what steps to take to head in the right direction is more than appreciated. The source code is below but not sure what it is exactly doing and how to make it work for me. Any suggestions are more than appreciated.
Thanks,
Eric Ehle

<script language="javascript" type="text/javascript">
function pageSearch(iVal) {
document.forms[0].currPage.value = iVal;
document.forms[0].submit();
}
</script>

<form action="news-search.php" method="post" name="dik_search">
ericehle
New php-forum User
New php-forum User
 
Posts: 3
Joined: Thu Jan 23, 2003 10:47 pm

Postby 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>
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Search

Postby 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.
greg
New php-forum User
New php-forum User
 
Posts: 11
Joined: Wed Nov 13, 2002 6:56 am

Postby 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.
bobaloo
New php-forum User
New php-forum User
 
Posts: 11
Joined: Sat Feb 01, 2003 11:34 am

Postby *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 :)
*JaH*
New php-forum User
New php-forum User
 
Posts: 80
Joined: Fri Jan 31, 2003 4:18 pm


Return to PHP General

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron