php分页不用get用post代码实例

php分页不用get用post代码实例

<a href='<?=$_SERVER['PHP_SELF'];?>?page=1'>1</a>

<a href='<?=$_SERVER['PHP_SELF'];?>?page=2'>2</a>

....

<form method="post" name="myform" action="<?=$_SERVER['PHP_SELF'];?>">

<input type="hidden" name="page" value="" />

</form>

<a href="#" onclick="mylink(1)">1</a>

<a href="#" onclick="mylink(2)">2</a>

....

<script language="java script">

function mylink(page)

{

document.getElementById('page').value = page;

document.myform.submit();

}

</script>

<?php

echo '<br />get page=' . $_GET['page'];

echo '<br />post page=' . $_POST['page'];

?>