title: Build URL from form fields with JavaScript or jQuery
body: <p>I'm trying to create a URL builder form with JavaScript or jQuery.</p>
  <p>Basically, it will take the value of the two form fields, add them to a preset URL and show it on a third field on submit.</p>
  <p>The resulting URL might be <a href="http://example.com/index.php?variable1=12&amp;variable2=56" rel="noreferrer">http://example.com/index.php?variable1=12&amp;variable2=56</a></p>
  <p>Now, this isn't the &quot;action&quot; of the form and the application can't read a URL (to grab the variables), so it has to be done on the page.</p>
  <p>The resulting URL will be shown in the field named &quot;url&quot;.</p>
  <p>Here's a sample of the form:</p>
  <pre><code>&lt;form id=&quot;form1&quot; name=&quot;form1&quot; method=&quot;post&quot; action=&quot;&quot;&gt;
    &lt;p&gt;
      &lt;label&gt;Variable 1
        &lt;input type=&quot;text&quot; name=&quot;variable1&quot; id=&quot;variable1&quot; /&gt;
      &lt;/label&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;label&gt;Variable 2
        &lt;input type=&quot;text&quot; name=&quot;variable2&quot; id=&quot;variable2&quot; /&gt;
      &lt;/label&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;label&gt;URL
        &lt;input type=&quot;text&quot; name=&quot;url&quot; id=&quot;url&quot; /&gt;
      &lt;/label&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;input type=&quot;submit&quot; name=&quot;button&quot; id=&quot;button&quot; value=&quot;Submit&quot; /&gt;
    &lt;/p&gt;
  &lt;/form&gt;
  </code></pre>