php使用php_self重新加载url中不同参数的页面

how to reload the same page with different parameters. coz i'm new to php so this way came into my mind. but it is giving the error header already sent.. here is the idea

//some script and at the last page   
if(isset($_GET['page'])){
    $page=$_GET['page'];
    $page++;
    header('Location: '.$_SERVER['PHP_SELF'].'page='.$page);
} else
    header('Location: '.$_SERVER['PHP_SELF'].'page=1');

i'm new any suggestion will be appriciated

So, you have to just correct the error you've got.
This error is the source of the most popular question on the Stackoverflow by the way.
thus, you will find plenty of the comprehensive answers.

Your way of the reloading is correct though.

I am only afraid it can become an infinite loop. What is the condition for this code to execute?

use some sort of break condition otherwise it will go into infinite loop.. just incrementing and reloading page again and again.. something like that

    if(isset($_GET['page'])){
        $page=$_GET['page'];
        $page++;
if(!$page>=50)
        header('Location: '.$_SERVER['PHP_SELF'].'page='.$page);
    } else
        header('Location: '.$_SERVER['PHP_SELF'].'page=1');