I need get method but not working
my code :
<?php
$page = $_GET['page'] ? intval($_GET['page']) : 1;
echo "current page : ".$page."<br/>";
?>
and
$page's result is 1. but i try www.example.com/test.php?page=3
$page's result is still output 1.
Why is this happening?
At first you should check if is page
setted, then you can access page
try this:
if(isset($_GET['page'])){
$page = $_GET['page'] ? intval($_GET['page']) : 1;
echo "current page : ".$page."<br/>";
}
here is the result i am getting: