For the second part you can still use php. with small amounts of javascript. You use "<script type="text/javascript" src="https://yoursite.com/index.php?p=2"></script>" And have the php file output run your request to get information in return the value as javascript. Then you can have php return the proper pagination numbers to change the page etc. Then you have javascript select the page and change the page number via "<script type="text/javascript" src="https://yoursite.com/index.php?p=2"></script>" which will reload the content only within the javascript.
While HolyRoller is right (always clean inputs using strip_tags at least) the example I provided don't need validation/strip_tags as it is going to check the INDEX of an ARRAY, it's not going to execute malicious inputs nor going to check databases. By the way HollyRoller is right, always remove malicious tags from the inputs, remove all the strange characters (that are so easy to get used to inject or break code) and strip/escape slashes... Oh boy, from basic programming straightly to securing a script... Please folks, always remember to play safe with your code!!!
Correct and Incorrect, what you propose require a page refresh, Op need to refresh just the DIV, not the entire page. Ajax or JS is the best way but not what you are proposing.
for part 2 you'll need a pager query in the url that can be passed to php to get the right page like : <a href="http://example.com?subject=math&page=1">1</a> example for page 1 then in your php : <?php $page = $_GET['pager']; $subject = $_GET['subject']; switch ($subject) { case 'subject1' : ... do something with $page and $subject break; } ?> Code (markup): it should work without ajax or iframe.
Once again you are also correct but OP want just a DIV to refresh, not an entire page. Ajax/JS it's the actual best solution.
My statement is correct, because then all he has to do is have javascript change p= number via javascript and it will reload the script. As its a javascript called script even tho it is calling to a php script. It will only reload whats on that piece of scripting. This would be a method for people with basic javascript skills. If you know more you can use jquery ajax feature as mentioned before by someone else.