If youa are using PHP, you don't need JS to do this...
If you are using a link, you can just add "?variablename1=variablevalue1&variablename2=variablename2" to the end of your hyperlink. You will then be able to reference $variablename1 and $variablename2 on the linked page.
If you are using a form, all form element names will be available as variables of the same name on the page that you reference in your <form> tag - even $submit!
If that doesn't work, I would just search Google for "javascript form variable url" - most of the big script snippet sites are cataloged.
Hope this helps!