0

Hi every gurus here, i was encounter problem in passing value into url, please refer to the script below, i have batch of records which fetch from database and had a quantity box and update button on each (using onclick updateValue() function), i created javascript array to get each quantity box value and each value to be assign to the url qty, this is the problem exist now, the url qty cannot get its exact value from qty except I manually assigned the qty like qty[1], qty[2] and so on...for instance i got 3 quantity text box in a loop, each text box hold values like '1','2','3', assume i onclick update button for record two, url will pass qty values like &qty=1,2,3 instead of &qty=2, this will causes my script couldn't continually process without the exact value pass to qty!

can anyone advise how to solve this issue in proper method?


<script type="text/javascript">
function updateValue(itemId,itemQty){
	var maxNum = "<?php echo $nMax; ?>";
	var qty = new Array();
	
	for(var i=1; i<=maxNum; i++){
		qty[i] = document.getElementById('txtQty_'+i).value;
	}
	self.location = '?mode=usrCart&act=updateCart&itm='+itemId+'&qty='+qty;
}
</script>

Thanks.

Edited by conmen80: n/a

2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by mahavir123
0
var qty = new Array(1,2,3);
document.write('<a href="file_name.php?qty='+qty+'">click link</a>');

In this you can pass the array separated by comma.
Can you use this.

This topic has been dead for over six months. 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.