Pass variable to HTML form Javascript
<p>Please excuse my inexperience as I am not a programmer just someone who dabbles at trying to make something work. I'm not sure of the correct terminology and complicated explanations will go straight over my head! </p>

<p>In essence I am trying to get part of the URL of a web page passed to a simple Form that is linked to a shopping cart. i.e. how do I get the filename into the form where I have xxxxxxx. Is it possible in Javascript?</p>

<pre><code>&lt;script type="text/javascript"&gt;
var url = window.location.pathname;
var filename = url.substring(url.lastIndexOf('/')+1);
document.write (filename);

&lt;/script&gt;
&lt;form action="http://www.mywebspace.com/cf/add.cfm" method="post"&gt;
&lt;input type="hidden" name="userid" value="12345678"&gt;
&lt;input type="hidden" name="product" value="xxxxxxx"&gt;
&lt;input type="hidden" name="price" value="5.00"&gt;
&lt;input type="Submit" value="Buy now!"&gt;
&lt;/form&gt;  
</code></pre>
