I am using GET/POST method to embed results from a Google Search Appliance into an iFrame on a WordPress page. The first page of results shows fine, but when you try to paginate to other pages, the query is dropped from the results display, so page 2 shows irrelevant search results.
Here is the code that embeds the results in my WordPress page template:
<?php
function showForm(){
//echo "<form action="http://example.com/search-results" method="post">";
//echo "<input id="searchform" type="text" name="q" style="display: inline-block; width: 450px;">";
//echo "<input class="btn btn-primary" type="submit" value="Search" name="btnG">";
//echo "</form>";
}
if (!empty($_POST['q'])) {
$searchClient = "WWW_frontend";
$searchOutput = "xml_no_dtd";
$searchSheet = "WWW_frontend";
$searchQuery = $_POST['q'];
echo "<p class="monospace" style="margin-bottom: 10px; padding-bottom: 0px;">You searched for: <b>".$searchQuery."</b></p>";
echo "<iframe id="_search-results" seamless="seamless" scrolling="no" style="width: 100%; border: none; height: 1200px;" name="_search-results" src="http://example.com/search?q=$searchQuery&client=$searchClient&output=$searchOutput&proxystylesheet=$searchSheet&proxyreload=1"></iframe>";
}else{
echo "<p>Nothing found! Please try your search again.</p>";
showForm();
}
?>