# Javascript: Pass query string variables to a form

**URL:** <https://forum.kirupa.com/t/javascript-pass-query-string-variables-to-a-form/247964>\
**Category:** web dev\
**Created:** [January 2, 2008, 10:30am UTC](https://forum.kirupa.com/t/javascript-pass-query-string-variables-to-a-form/247964 "2008-01-02T10:30:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tommythewolfboy](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@tommythewolfboy](https://forum.kirupa.com/u/tommythewolfboy)\
**Post date:** [January 2, 2008, 10:30am UTC](https://forum.kirupa.com/t/javascript-pass-query-string-variables-to-a-form/247964/1 "2008-01-02T10:30:52Z")

</div>

OK, my javascript is pretty rubbish, so can anyone help with the following?

I am passing two variables via a URL to a second page containing a form, e.g. generated URL query string is ‘[www.myweb.com?formID=form1&hiddenVar=value1](http://www.myweb.com?formID=form1&hiddenVar=value1)’.

What javascript do I need on the page with the form so that ‘value1’ is passed to the hidden field (lets call it ‘hiddenField1’) in ‘form1’?

THANKS!
