title: How to transfer specific value from one page to another?
body: <p>I have two pages the first is called store.php and the other cart.php. I try to transfer the total rows number from a table from the page cart.php on the store.php page that I have the cart icon and i put the number of products above it. My idea was through javascript count all rows in the table and place it on the cart icon. The problem is as much as try I can not get the value of all rows from the page cart.php inside to store.php.</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;html&gt;
  
      &lt;head&gt;
          &lt;link rel="stylesheet" type="text/css" href="main.css"&gt;
  
          &lt;title&gt;store&lt;/title&gt;
  
          &lt;meta charset="UTF-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  
          &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"&gt;
          &lt;link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css"&gt;
  
          &lt;script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"&gt;&lt;/script&gt;
  
      &lt;/head&gt;
  
      &lt;body&gt;
  
              &lt;div class="Cart"&gt;
  
                  &lt;a href="cart.php"&gt;
  
                      &lt;i class="fa fa-shopping-cart" aria-hidden="true"&gt;&lt;/i&gt;
  
                      &lt;span class="Cart_Number" id="Cart_Number"&gt;&lt;/span&gt;
  
                  &lt;/a&gt;
  
              &lt;/div&gt;
  
          &lt;script type="text/javascript" src="Counter_Cart.js"&gt;&lt;/script&gt;
  
      &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <pre class="lang-php prettyprint-override"><code>&lt;html&gt;
  
      &lt;head&gt;
          &lt;link rel="stylesheet" type="text/css" href="main.css"&gt;
  
          &lt;title&gt;cart&lt;/title&gt;
  
          &lt;meta charset="UTF-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  
          &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"&gt;
          &lt;link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css"&gt;
  
          &lt;script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"&gt;&lt;/script&gt;
  
      &lt;/head&gt;
  
      &lt;body&gt;
  
              &lt;table style="width:100%" id="Product_Map"&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Product name&lt;/th&gt;
                      &lt;th&gt;Quantity&lt;/th&gt; 
                      &lt;th&gt;Price&lt;/th&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Product 1&lt;/td&gt;
                      &lt;td&gt;Product 1&lt;/td&gt;
                      &lt;td&gt;Product 1&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Product 2&lt;/td&gt;
                      &lt;td&gt;Product 2&lt;/td&gt;
                      &lt;td&gt;Product 2&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Nothing&lt;/td&gt;
                      &lt;td&gt;Nothing&lt;/td&gt;
                      &lt;td&gt;Total&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
  
           &lt;script type="text/javascript" src="Counter_Cart.js"&gt;&lt;/script&gt;
  
      &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <pre><code>function CountRowsUsingJavascript() {
  
      var totalRowCount = 0;
  
      var table = document.getElementById("Product_Map");
  
      var rows = table.getElementsByTagName("tr");
  
      for (var i = 0; i &lt; rows.length; i++) {
  
          if (i &gt; 0) {
  
              totalRowCount++;
  
          } else {
  
              totalRowCount = 0;
  
          }
  
      }
  
      if (totalRowCount &gt; 0) {
  
          totalRowCount = totalRowCount - 1;
  
          return totalRowCount;
  
      } else {
  
          return totalRowCount;
  
      }
  
  }
  
  var Value_For_The_Cart = CountRowsUsingJavascript();
  
  </code></pre>