I have a php page which dynamically produces this;
...
<select name='sales_id'>
<option>
<option onclick='select_person(2)'>name1
<option onclick='select_person(3)'>name2
<option onclick='select_person(4)'>name3
</select>
<h2 style='text-align:center;font-size:120%;'>Planned Activities</h2>
<table width='100%' border='1' cellspacing='0' cellpadding='3'>
<th>Week Opened</th><th>Week Closed</th><th>Company<br>
<select name='text'>
<option>
<option onclick='filter_company(comp1)'>comp1
<option onclick='filter_company(comp2)'>comp2
<option onclick='filter_company(comp3)'>comp3
<option onclick='filter_company(comp4)'>comp4
<option onclick='filter_company(comp5)'>comp5
</select>
...
In the js file I have ;
function select_person(userid) {
var link="welcome.php?sales_id="+userid;
document.location.href=link;
}
function filter_company(company) {
var link="welcome.php?filter=company&text="+company;
document.location.href=link;
}
The select_person function works but for some reason the filter_company function does not. I am at a loss!
You need to quote the arguments passed to
filter_companyso that they are interpreted as string literals, not variables.