Hi all ,

I want to create a search page like csoft.com . Open the site in a browser and enter "wiseimage" in search option left side of the page Search ,search the site and enter "wiseimage" and see the result. According the result of this site I want to create a search page which is coming from the database.

Thanks in advance

Subrata

<!--javascript in index.php page starts --> 

<script type="text/javascript">
function submitform()
  {
   document.search_form.submit();
  }
</script>
<!--javascript in index.php page ends --> 





<!--search.php page starts --> 
 <div id="content">
        <h2>search <span>results</span></h2>
            <?php



            $searching=$_REQUEST['searching'];
          //This is only displayed if they have submitted the form 
       if ($searching =="yes") 
          { 
          $headmess="<h2>search <span>results</span></h2>"; 
          $find=$_POST['query'];
          //If they did not enter a search term we give them an error 
         if ($find == "") 
              { 
              $forgotmess="<p>You forgot to enter a search term"; 
              exit; 
             } 

             // Otherwise we connect to our Database 
             // mysql_connect("mysql.yourhost.com", "user_name", "password") or die(mysql_error()); 
            // mysql_select_db("database_name") or die(mysql_error()); 

           // We preform a bit of filtering 
            $find = strtoupper($find); 
            $find = strip_tags($find); 
            $find = trim ($find); 

          //Now we search for our search term, in the field the user specified 
          $data = mysql_query("SELECT * FROM  csoft_page WHERE upper(page_content) LIKE'%$find%'"); 

          //And we display the results 
          while($result = mysql_fetch_array( $data )) 
               { 
              /* echo '<span style="color:#FF0000">'.$result['page_title'].'</span>'; 
               echo " "; */
               echo '<span style="color:#FF0000">'.$result['page_content'].'</span>'; 
               echo "<br>"; 
              /* echo '<span style="color:#FF0000">'.$result['page'].'</span>'; 
               echo "<br>"; 
               echo "<br>"; */
               } 

             //This counts the number or results - and if there wasn't any it gives them a little message explaining that 
              $anymatches=mysql_num_rows($data); 
              if ($anymatches == 0) 
                 { 
                  echo "Sorry, but we can not find an entry to match your query<br><br>"; 
                 } 

                //And we remind them what they searched for 
                 echo "<b>Searched For:</b> " .$find; 
              } 
         ?>

    </div>
    <!--search.php page ends --> 




 <!--index.php page starts --> 
    <div class="margins">
                      <div class="left">
                       <form name="search_form" action="search.php" method="post">
                            <input id="query" name="query" type="text"  class="searchbox" placeholder="Site search" />
                            <input type="hidden" id="searching" name="searching" value="yes" />
                        </form>
                      </div>
                      <div class="right"><a href="javascript: submitform()"><img src="images/search-icon.png" alt="" width="17" height="17" border="0" /></a></div>

 <!--index.php page ends --> 
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.