Sry, for unclear title to the question, I hope someone will correct it to something more precise.
The situation:
I am using a google custom search engine which is set to search only two sites and display results only.In control panel of GSE when I go to advanced tab in search features, i can specify query parameter that it will look for. after I am done i get a javascript code to paste in my page's code.
I believe that this javascript code listens to $_GET['q'] variable and then produce results based on that.
Problem :
I have four field in a page and a php form set up to display result from the other sites, the end result is the URL with four get variables like $_GET['q1'] to $_GET['q4']. I don't have a $_GET['q'] in the page or anywhere else.
What I tried:
I just can't make the earlier form to print another or a combined get parameter as $_GET['q']. i'll have to add a lot of JS and a hidden input field i guess.
I tried setting $_GET['q'] in php as
$_GET['q']=$_GET[q1];
and then adding the javascript for custom search engine.I tried adding a link to update or set GET
<a href="myurl.com?q=searchthis">anything</a>
but this doesn't seem to work.
I think the reason is maybe lack of knowledge about how GSE gets a keyword,search and returns result, and lack of knowledge about $_GET parameter.
Question:
- Anyway I can set $_GET['q'] in my php script(dynamically?) that google custom search engine javascript will understand and work fluently ??
- Is there any other better way to do this.
This doesn't need me to show code but here is some code that may be relevant to the question :
GOOGLE CUSTOM JAVASCRIPT
<script>
(function() {
var cx = '010474608308939830468:6s3kklfffuu';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:searchresults-only></gcse:searchresults-only>
And here is my php approach :
$_GET['q'] = $_GET['q1'] ;
any help will be greatly appreciated and hope you can also clear out on the functioning of GSE for fellow readers. Thanks, in advance