How to combine two form fields into a variable with jQuery?


I'm pretty new to jQuery and I've been given a task I really have no idea how to complete. Here's the situation:

I have a form as follows:


<form action="search.php" method="get" id="cse-search-box">
  <input type="text" name="q" size="31"/>
  <select name="category">
  <select name="contributors">
  <input type="submit" name="sa" value="Search" />

The form is used to submit a query to google site search. The input field 'q' is the main search query.

I need to combine the user's choices in the 'category' and 'contributors' fields into one variable, named 'as_q', and insert this into a form field on submission.

Thanks in advance for any help

    $('#cse-search-box').bind('submit', function(){
        var category = $('[name=category]').val();
        var contributors = $('[name=contributors]').val();
        $('[name=q]').val(category+' '+contributors);

Have this piece of script after the <form> is declared (it's html, i'm not very sure if it is appropriate to use declare)