New to PHP Code Snippets, but the Code Snippet that is a form on bottom of home page moves after requesting to view the next page results. Unsure what to do, to solve the problem.
This is the PHP Code Snippet:
<?php if (isset($_POST["languageSearch"]) || isset($_GET["languageSearch"])) { //Use wp global database object global $wpdb; if (isset($_POST["languageSearch"])) { $languageSearch=$_POST["languageSearch"]; //echo "The code setting POST is " . $languageSearch . ""; unset($_POST["languageSearch"]); } if (isset($_GET["languageSearch"])) { $languageSearch=$_GET["languageSearch"]; //echo "The code setting GET is " . $languageSearch . "
"; unset($_GET["languageSearch"]); } echo '
';
$languageQuery = "SELECT * FROM `language` ORDER BY `language_name`";
$languageResults= $wpdb->get_results($languageQuery);
echo "";
echo"";
echo"All Languages";
foreach($languageResults as $tableRowL)
{
if ($languageSearch == $tableRowL->language_id)
{
echo '
' . $tableRowL->language_name . ' '; } else { echo ' ' . $tableRowL->language_name . ' '; } } echo " "; echo " "; echo ' |
'; echo ""; echo ""; echo ""; echo ' | |
Linket | Owner | |
' . $linket . ' | ' . $name . ' |
Page ' .$page. ' of ' .$totalPage. ' ' .paginate_links( array(
'base' => add_query_arg( array('cpage'=> ' %#% ' , 'languageSearch'=> $languageSearch, 'searchNames'=> $searchNames)),
'format' => '',
'prev_text' => __(' « '),
'next_text' => __(' » '),
'total' => $totalPage,
'current' => $page
)).'
';
}
echo $customPagHTML;
}
elseif (isset($_POST["searchNames"]) || isset($_GET["searchNames"]))
{
$searchNames = $_POST["searchNames"];
unset($_POST["searchNames"]);
if (isset($_GET["searchNames"]))
{
$searchNames=$_GET["searchNames"];
//echo "The code setting GET is " . $searchNames . ""; unset($_GET["searchNames"]); } //Use wp global database object global $wpdb; //echo "The search name setting is " . $searchNames; echo '
';
$languageQuery = "SELECT * FROM `language` ORDER BY `language_name`";
$languageResults= $wpdb->get_results($languageQuery);
echo " "; echo" "; echo"All Languages "; foreach($languageResults as $tableRowL) { echo ' ' . $tableRowL->language_name . ' '; } echo "Search Results "; echo " "; echo " "; echo ' |
'; echo ""; echo ""; echo ""; echo ' |
Linket | Owner |
' . $linket . ' | ' . $name . ' |
No search results. |
Page ' .$page. ' of ' .$totalPage. ' ' .paginate_links( array(
'base' => add_query_arg( array('cpage'=> ' %#% ' , 'languageSearch'=> $languageSearch, 'searchNames'=> $searchNames)),
'format' => '',
'prev_text' => __(' « '),
'next_text' => __(' » '),
'total' => $totalPage,
'current' => $page
)).'
';
}
echo $customPagHTML;
}
else
{
//Use wp global database object
global $wpdb;
//echo "The second code setting is " . $languageSearch . ""; echo '
';
$languageQuery = "SELECT * FROM `language` ORDER BY `language_name`";
$languageResults= $wpdb->get_results($languageQuery);
echo " "; echo" "; echo"All Languages "; foreach($languageResults as $tableRowL) { echo ' ' . $tableRowL->language_name . ' '; } echo " "; echo " "; echo ' |
'; echo ""; echo ""; echo ""; echo ' | |
Linket | Owner | |
' . $linket . ' | ' . $name . ' |
Page ' .$page. ' of ' .$totalPage. ' ' .paginate_links( array(
'base' => add_query_arg( array('cpage'=> ' %#% ' , 'languageSearch'=> $languageSearch, 'searchNames'=> $searchNames)),
'format' => '',
'prev_text' => __(' « '),
'next_text' => __(' » '),
'total' => $totalPage,
'current' => $page
)).'
';
}
echo $customPagHTML;
}
?>