I am trying to pass two variable using javascript but i dont really know the syntax

if(entity==3){
   var month = document.getElementById('mymonth').value;
   var program = document.getElementById('mylist').value:
				
	location.href = "view_results.php?month="+month;

i only how to pass month but i cant figure out how to pass both month and program

thanks in advanced

location.href = 'view_results.php?month=' + month + '&program=' + program;

It's sometimes convenient to build the string like this:

var querystring = [];
querystring.push('month=' + month);
querystring.push('program=' + program);
location.href = 'view_results.php?' + querystring.join('&');

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.