HTML question:

I set up the free Google website search for my alumni website. It lets my users search my site using a text box.

I had the idea to modify the code Google provides to create a pre-defined search string. Why? This may my users can just click the Search button and they will find results for my pre-defined categories.

(For instance, one pre-defined search string could be something like ‘Location: Boston’. That could list every alumni who lives in Boston because the ‘Location: XXX’ syntax is used on every alumni bio page.)

Anyway, part of the form code would look something like this:

  **<INPUT TYPE="hidden" NAME="query" VALUE="location: Boston" SIZE="12">**

HERE’S MY QUESTION…

I want Google to search for the VALUE as a phrase – not just as a series of words. But I can’t add another set of quotation marks in the code.

I’ve tried to use %22 – the HTML code for quotation marks – but Google interprets %22 literally and includes %22 as one of the keywords.

Help!

How can I pre-populate the VALUE field in a form with a phrase already in quotation marks?

Thanks.

  • TS

I think you’re more likely to get an answer in General Questions than MPSIMS, so I’ll move this thread over there.

I don’t know if adding quote marks will work. The HTML for quotes, though, is "

I think what you are looking to do has more to do with Google’s programming more than yours. They are looking for “query LIKE Location:Boston” and you want it to do “query IS location: boston”.

Something like that.

Doesn’t Google use pluses to concatenate words and make a phrase? Would VALUE=“location:+boston” work?

Surround the phrase in single quotes, e.g. ‘location: Boston’.

(hand outstretched, palm facing up) $75.

Use single quotes; they nest with double quotes just fine. If for some reason you need three layers of nested quotation marks, you are SOL as far as I am aware.

What would be cool is if, instead of a single quote and a double quote, we had an open quote and a close quote, like we do with parentheses. Much less ambiguity that way.

You cannot escape using the %22 stuff because that is URL escaping. To escape double quotes in HTML attributes you use HTML escaping - *&*quot; = ". It looks like ZipperJJ already tried to say this, but his escape sequence actually got turned into a literal double quote. vBulletin seems to honor SOME escape sequences when typed into messages and not others - curious.

Google will search for phrases using other characters too:

e.g. “example text” should, in theory, return the same as example.text

Code the value using periods as the ‘connectors’ and it may work.

Google certainly searches for phrases using periods – I can vouch for that.

Yabob,

Your suggestion about using " to represent quotation marks in the VALUE=“yada yada” field worked!!

When I click search, the query is sent to Google and it interprets it as if I went to their site and manually entered the phrase “yada yada”.

Thanks for your help! This was killing me. And thanks to everyone else too.

Oops. Looks like the code

&
q
u
o
t
;

was interpreted by the Board as a quotation mark! Anyway, to repeat, the above string of characters did the tricks. Thanks!

Maybe I’m being dumb here, but couldn’t you just have a link like this?

Manduck,

Yes you could if you wanted to search the general Google database. But I’m using the free Google search that searches only pages of a certain domain. So I had to modify the VALUE code in the FORM provided by Google.

Of course, now that I’m thinking about it, I’m pretty sure Google lets you search the pages of particular domains. Yup, just checked. This is what Google says:


If you know the website you want to search but aren’t sure where the information is located within that site, you can use Google to search only that domain. Do this by entering what you’re looking for followed by the word “site” and a colon followed by the domain name.

For example, to find admission information on Stanford University’s site, enter:

admission site:www.stanford.edu

Hmm. So I guess as long as you ask Google to spider your entire site, you don’t really need to sign up for the free Google search service. You can simply create a link, like Manduck suggests.

Of course, when you sign up with Google, they let you add your logo above the search results page and let you customize some of the page. But other than that, they seems to be no benefit.