Undefined variable when using $_SERVER['PHP_SELF']

Posted on 16th Feb 2014 by admin

Hi guyz, please suggest me something...
On first.php I have one input field NAME, and on posting the form it moves to "second.php" showing the entered value of input field using $_POST, everything works fine....

But on second page, I have 'n' number of results coming from database. So to control their display,
I use pagination.....< [1] 2, 3 > its like only 10 records in one shot

when I click on 2, to see the records from 11-20

URL get change to http://localhost/test/second.php?pg=2
from http://localhost/test/second.php
and start displaying message Notice : Undefined variable NAME on line 18, whereas earlier it was defined for the page

I m using <a href='{$_SERVER['PHP_SELF']}?pg=$x'>$x</a> for paging

What is the possible solution and why its not recognizing the posted variable now??

Other forums