0

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

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Airshow
0
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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.