473,847 Members | 1,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Search the site?

150 New Member
[HTML]<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search </title>
</head>

<body>
<form id="form1" name="form1" method="post" action="index.p hp">
<input name="Search_IN " type="text" id="Search_IN" maxlength="44" />
<input type="submit" name="SearchBTN " id="SearchBTN" value="Search" />
</form>[/HTML]
[PHP]<?php

$YourSearch=str tolower($_POST['Search_IN']);
$text=ucfirst($ YourSearch);


if($_POST['SearchBTN']){
if(!ereg("^[a-zA-Z ]{4,44}$",$YourS earch)){
echo "Please Wright Rorrect Data";
exit;
}else{
echo "Your Search results for {$text} is :<br />";
if ($handle = opendir('../Search')) {
while (false !== ($file = readdir($handle ))) {
if($file=="." || $file==".." || $file=="_notes" || $file=="Result. php" || $file=="index.p hp"){
//--------------------------------------------------------------
}else{
//get the files information
$All_Files .= $file."*";
$All_Files_Data =explode("*",$A ll_Files);
}
}
closedir($handl e);
}
}

for($i=0;$i<cou nt($All_Files_D ata);$i++){
if(is_file($All _Files_Data[$i])){
if(strchr(strto lower(file_get_ contents($All_F iles_Data[$i])),$YourSearch) ){
echo "<a href='$All_File s_Data[$i]'>$All_Files_Da ta[$i]</a><br />";
}
}else if(is_dir($All_ Files_Data[$i])){
echo "The dir is : {$All_Files_Dat a[$i]}<br />";
echo "<a href='$All_File s_Data[$i]'>$All_Files_Da ta[$i]</a><br />";
}
}
}

?>[/PHP]
[HTML]</body>
</html>[/HTML]

This code to search on my site but im having problem with the code,when the user search the site i need to tell the user if he did't fined any result.
Jul 30 '07 #1
1 1498
kovik
1,044 Recognized Expert Top Contributor
This code to search on my site but im having problem with the code,when the user search the site i need to tell the user if he did't fined any result.
And that's the hard part...? Why don't you keep track of how many records were displayed? Maybe check the value of $i after the for loop.
Jul 30 '07 #2

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

Similar topics

0
4163
by: R. Rajesh Jeba Anbiah | last post by:
Q: Is PHP search engine friendly? Q: Will search engine spiders crawl my PHP pages? A: Spiders should crawl anything provided they're accessible. Since, nowadays most of the websites are been developed with PHP, you are not supposed to doubt that. As a proof that PHP pages could be crawled and indexed, refer this Google search
3
2522
by: Carol | last post by:
What's the best way to do a site search of my site? I am using asp and access heavily on a regular ISP google? Or write a bunch of queries? what else is there?
11
4244
by: Petre Huile | last post by:
I have designed a site for a client, but they have hired an internet marketing person to incrase their search engine ranking and traffic. He wants to put extra-large fonts on every page which will make the design looks a bit rediculous. He also said that the big text cannot be hidden. I am just trying to find a compromise. Here are the questions: (1) Is it true that a page with an <H1> tag and very big font size will make a search...
14
4642
by: vic | last post by:
My manager wants me to develop a search program, that would work like they have it at edorado.com. She made up her requirements after having compared how search works at different websites, like eBay, Yahoo and others. This is what she wants my program to be able to do: (try this test at different websites just for fun). At eBay: - enter the word 'television' in a search field à you will get 2155 items.
4
1566
by: Miguel Dias Moura | last post by:
Hello, I launched a web site some time ago and i am having problems in making it visible in the search engines. I used a lot of Keywords, not only in text but also in links, page and image names. I have 2 questions: 1. Can you tell me what else can i do?
3
2661
by: hazly | last post by:
I'm very new in the web technology and need advice on search engine. I want to develop a portal using PHP and MySQL on Linux. Need to know on the following features : 1. search engine that could search my portal (mySQL, PDF, Ms Word & others) 2. search engine that could search to few web sites specified by user/programmer
4
2186
by: MDW | last post by:
Posted this on another board, but evidently it was off-topic there...hope you folks will be able to provide some guidance. I've been working on a Web site for a business (my first non-personal site) and I want to help my client get the best search engine listing. Because this is my first for-profit site, I'm not sure what I need to do for optimal search engine placement. I've been poking around the Web, and I think I have a good start,...
2
1668
by: Griff | last post by:
Hi We have an eCommerce site that was designed as a BusinessToBusiness system. When anyone accesses a page, the site checks to see whether they have a current session (i.e. already authenticated) and if not it redirects them to the log-on page. Recently, we added some BusinessToConsumer functionality. The same authentication process described above applies, but when the unknown user gets redirected to the logon page they see a button...
0
9732
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10988
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10652
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10344
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7058
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5723
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5914
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4536
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.