Problem in pagination when click any page

Three if condition
if(isset($_POST['search']) & !empty($_POST['searchdata']) )

if(isset($_POST['search']) & !empty($_POST['searchName']) )

Else
each statement have the own pagination created now confusion for example first condition is true and three page is created when i click its goes to else condition and below 10 pages is created which is true in else condition..how to handle the click of page to go to their respective condition