Solved

Add a hidden term to search

Posted on 2004-08-25
11
177 Views
Last Modified: 2012-05-05
Hi

1.How can i add an unseen search term to one of these searches, so that for instance the first search is always loaded with the word "html" but the user cant see this.
Whatever keywords they add are added to "html" and the search looks for all of them.

2.How can I do this with more than one hidden term eg, "html" and "learn"

3.And can these terms be labelled as something other than "keywords" so that the search results don' t say, eg if the search term was 'div'
Results for html learn div...BUT
Results for div
--as the search is set up to say "Results for 'keywords' "

 - putting my last current lot of points up.

Thanks
====================
<form method="get">


  <table width="98%" border="0" align="center">
    <tr>
      <td> <div align="right">
          <input type="hidden" name="keywords">
     
          <input type="text" name="search" size="20" maxlength="255">
        </div></td>
      <td><div align="left">

          <input type="submit" style="width:110;text-align:center" value="Web Search" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/search/search.cgi?keywords ';">

          <input type="submit" style="width:110;text-align:center" value="Directory" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/dirr/search/search.cgi?keywords ';">

                 </div></td>
    </tr>
  </table>

</form>
0
Comment
Question by:macuser777
  • 6
  • 5
11 Comments
 
LVL 8

Expert Comment

by:trevorhartman
Comment Utility
If you are using search.com's search engine, there is no way to control what it displays.  If you submit keywords to it, it will display them.  Do you still need help figuring how to append "html" to the beginning of your search term?
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
I am using a product called smartsearch. I just put search in for example.

http://smarterscripts.com/smartsearch/

i'm playing with the script to try and make it a more focused search.

0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
..so yes help still required...appending terms would be a start anyway...
0
 
LVL 8

Expert Comment

by:trevorhartman
Comment Utility
use a onSubmit event handler for your form, and append whichever keywords you want to the beginning of the input
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>>>      use a onSubmit event handler for your for your form, and append whichever keywords you want to the beginning of the input.

Can you supply an example of what you mean please.

0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 8

Expert Comment

by:trevorhartman
Comment Utility
<script>
function addTerms()
{
 document.forms[0].search.value = 'html ' + document.forms[0].search.value;
 return true;
}
</script>
<form method="get" onSubmit="addTerms()">


  <table width="98%" border="0" align="center">
    <tr>
      <td> <div align="right">
          <input type="hidden" name="keywords">
     
          <input type="text" name="search" size="20" maxlength="255">
        </div></td>
      <td><div align="left">

          <input type="submit" style="width:110;text-align:center" value="Web Search" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/search/search.cgi?keywords ';">

          <input type="submit" style="width:110;text-align:center" value="Directory" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/dirr/search/search.cgi?keywords ';">

                 </div></td>
    </tr>
  </table>

</form>
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
My question asks for a hidden term to be added to ONE of the searches. This code adds it to both.

Also my qusetion asks for it to be a hidden term - this puts the added terms into the input box.
0
 
LVL 8

Expert Comment

by:trevorhartman
Comment Utility
ok, this is because only 1 input can be submitted to the search.  I will get an example that allows it to be hidden.
0
 
LVL 8

Accepted Solution

by:
trevorhartman earned 80 total points
Comment Utility
<form method="get">


  <table width="98%" border="0" align="center">
    <tr>
      <td> <div align="right">
          <input type="hidden" name="keywords">
     
          <input type="text" name="search" size="20" maxlength="255">
        </div></td>
      <td><div align="left">

          <input type="submit" style="width:110;text-align:center" value="Web Search" onclick="this.form.keywords.value = 'html' + this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/search/search.cgi?keywords ';">

          <input type="submit" style="width:110;text-align:center" value="Directory" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/dirr/search/search.cgi?keywords ';">

                 </div></td>
    </tr>
  </table>
</form>
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
Hi

That works well for my first 2 requests - very well actually. Thanks.

With regards to renaming the hidden term something other than 'keywords' - I guess that's probably another Q.

I'll leave it open for a while just in case - otherwise i'll ask that part in another q.

Thanks again

macuser
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
thanks for your help :)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now