title: Adding multiple variables in the page URL using javascript
body: <p>Since I'm relativly new to the use of php and javascript I ran into this problem while trying to add multiple variables in a URL</p>
  
  <p>I use the following script:</p>
  
  <pre><code>&lt;script&gt;
  function refresh() {
   var PCWDE = document.getElementById("PC");
   var NMWDE = document.getElementById("naam");
   var VNMWDE = document.getElementById("voornaam");
   var ONDWDE = document.getElementById("onderneming");
   var BTWWDE = document.getElementById("btwnummer");
   var LNDWDE = document.getElementById("land");
  
  
          this.document.location.href = "http://example.com/form.php?PCS=" + PCWDE.value "&amp;nm=" + NMWDE.value "&amp;vnm=" + VNMWDE.value "&amp;ond=" + ONDWDE.value "&amp;btw=" + BTWWDE.value "&amp;lnd=" + LNDWDE.value;
  
  }
  &lt;/script&gt;    
  </code></pre>
  
  <p>That's beeing activated trough the following html code:</p>
  
  <pre><code>    &lt;?php
      $pc = $_GET['PCS'];
      echo '&lt;input type="text" name="pc" id="PC" onblur="refresh()" value="'.$pc.'"&gt;'
      ?&gt;
  </code></pre>
  
  <p>The main reason for the use of this html code was that I needed to execute a query without submitting the form, while still beeing able to hold the value of the text box even when the page would refresh. The above html code is used multiple times with the use of different ID's.</p>
  
  <p>The problem I face while trying to do this is that my code only works when only adding 1 variable to the URL like so:</p>
  
  <pre><code> this.document.location.href = "http://example.com/form.php?PCS=" + PCWDE.value;
  </code></pre>
  
  <p>Otherwise it does not work. Either the 'onblur' event fails to work, or the script fails to run.</p>
  
  <p>Is there a way to add the multiple variables to the URL in a similiar way to what i'm doing now?</p>