Using query URL in the form <p>I am practicing on how to query url. But i could not get my expected output. Here is my code:</p> <p>Form 1:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Save Value&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="display.html" method="get"&gt; &lt;label&gt; First Name: &lt;input name="name" size="20" maxlength="25" type="text" id="name" /&gt; &lt;/label&gt; &lt;input type="submit" value="submit" /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Form 2: </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Display&lt;/title&gt; &lt;script type="text/javascript"&gt; &lt;script type="text/javascript"&gt; function queryVar(variable) { var query = location.search.substring(1); var vars = query.split("&amp;"); var i; for (i = 0; i &lt; vars.lenght; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } return(false); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="#"&gt; &lt;label&gt; First Name: &lt;input name="name" size="20" maxlength="25" type="text" id="name" readonly="readonly" /&gt; &lt;/label&gt; &lt;script type="text/javascript"&gt; var firstName = document.getElementById("name").value; firstName = location.search.substring(1); &lt;/script&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>So when i clicked submit button it will go to form 2 and will display the value that i typed in the form 1.</p> <p>Thank you for your help!</p>