Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing Multiple Selections

Status
Not open for further replies.

KingSlick

Programmer
Mar 9, 2007
45
US
I am using AJAX to remove selections from a DB. These selections are listed inside of a <select> box. I am able to remove one sleection at a time, however, I am trying to be able to remove multiple selections at a time.

See code below...

Code:
function removeCompany(profile, selBox) {
	if (searchReq.readyState == 4 || searchReq.readyState == 0) {
		var box = document.getElementById("Select1");
		var str = '';
		var val;
		str = box.options[box.selectedIndex].text.replace(/&/g,"*amp*");
		//alert(str);
		searchReq.open("GET", 'ajaxRemove.php?t=CompanyName&p=' + profile + '&str=' + str , true);
		searchReq.onreadystatechange = removeCompanySelect;
        searchReq.send(null);

	}
}

Now what I would like to be able to do is get the selected values and have those become the "str" variable, as a comma delimited string. However, I haven't been able to get a loop to get all of the values to be added to the str.

any help would be great.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top