How do incoporate some javascript within php to pass data?
<p>I am trying incorporate some javascript within the php below to pass a variable to the next page (checkout.php).  It worked initially, but now I am having trouble executing this properly.  Any tips?</p>

<pre><code>    echo '&lt;div class = "row"&gt;&lt;div class = "span 4 offset6"&gt;&lt;select style="width:                130px;" name="shipping" class="span2"&gt;
            &lt;option value="0"&gt;7-9 days: FREE&lt;/option&gt;
            &lt;option value="7"&gt;3-5 days: $7&lt;/option&gt;
                                    &lt;option value="17"&gt;2 days: $17&lt;/option&gt;
            &lt;option value="22"&gt;1 day: $22&lt;/option&gt;
            &lt;/select&gt;&lt;/div&gt;&lt;/div&gt;';
            }


    echo '&lt;script language="javascript"&gt;
    function test()
    {
        var val=document.getElementById("select").value;  
        var hrf="checkout.php?options="+val;
        document.getElementById("a_link").href=hrf;
    }
    &lt;/script&gt;
    &lt;a href ="#" id="a_link" onclick="test();" class="btn btn-success" type="submit"&gt;&lt;i class="icon-shopping-cart icon-white"&gt;&lt;/i&gt;  Add to Cart&lt;/a&gt;';
</code></pre>

<p>EDIT: The problem I having is that when I click on the button, it stays on the same page instead of going to checkout.php with the option parameter.</p>

<p>Even when I change the first line of the javascipt to: 
     var val=document.getElementByName("shipping").value;<br>
The page still stays the same.  I'm assuming this is where the issue is but I odn't know how to fix it. </p>
