ahmed ahmed - 1 year ago 53
HTML Question

How to obtain page number from html web address

I'm trying to get page number from web address like


but, if I use php
method, then it's not returning anything.

I hope to find any easy solution.


Answer Source

If You Want that parameter on html page then you have to use javascript for it

    var param1var = getQueryVariable("page");

    function getQueryVariable(variable) {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
          return pair[1];
      alert('Query Variable ' + variable + ' not found');

if you are on php page simply use

 echo  $_GET['page'];