Google Search

Question I am attempting to insert dynamic text into a Google Search text box. The input box is located at the top of every review we have, but we want the title of the review to already be filled into the box.

The trick is that, to keep the input text box 'genuine' and valid we CANNOT edit the google code. I need a way to search the document for the search box (if present) and input the code as needed. The Google Search code defines the input box as named "Q". The review title is defined as "$row_rev['TITLE']" (which is coded in PHP).

I'm having a mind blank, and cannot find anything online. Can you help?
Jonathan Bruneau

Answer: To be able to reference the field from Javascript you will either have to update the form tag to give the form a name so that you can reference document.formname.q.value or update the q field to give it an id so that you can reference document.getElementById('q').value.

Since not everyone runs Javascript and you have to update the Google supplied code to get it to work anyway why not just use value="<? echo $from_rev['title'] ?>" which is a much smaller change to the Google code and will work for everyone.

None of these changes are going to affect Google recognising things as long as the value of the hidden client field remains unchanged as that one value is all Google needs to recognise your copy of their code regardless of the other changes you make to it.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow