If I have a code to display the links of Page. and I want to show a message "You are in this page" what should I do? my code to display links of pages is
if( $page > 1 ) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.($page-1).'&date1='.$_REQUEST["date1"].'&date2='.$_REQUEST["date2"].'">Previous</a>';
}
for( $i = 1; $i < $totalPages; $i++){
echo ' <a href="'.$_SERVER['PHP_SELF'].'?page= '. $i .'&date1='.$_REQUEST["date1"].'&date2='.$_REQUEST["date2"].'">' . $i . '</a> ';
}
if( $page < $totalPages ) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.($page+1).'&date1='.$_REQUEST["date1"].'&date2='.$_REQUEST["date2"].'">Next</a>';
}
On the landing page, you can check for $_GET['page']
:
switch ($_GET['page']) {
case 2:
'Do Something for page 2';
break;
case 3:
'Do Something for page 3';
break;
case 4:
'Do Something for page 4';
break;
}
try this,
echo "You are in $_REQUEST['page'] page";
and if you assign a current page into $page
then use this,
echo "You are in $page page";