I am trying to create a web site with a table of results that will have a drop down box at the end of each row that will let you select a quantity you would like of that row. In my case the user could have thousands of results based on their search criteria with a possibly large and variable amount of results on the page at one time.
I want to use an onchange
or similar method to immediately update each change in the background (update query to table) without reloading the page. No other information on the page will change and it would be an unnecessary delay to the user to reload the page, especially with all the pulls from tables that would mean.
I have been searching the net for several days now, and finally figured out how to get the information extracted on which drop down was changed and what it was changed to in JavaScript.
I haven't found how to trigger my update SQL command without reloading a page. Can someone please tell me how I get the variables I just extracted to an SQL update without reloading the page?
Here is what I have so far. Any help would be appreciated.
function quantityfunction(select)
{
var selectedOption = select.options[select.selectedIndex];
alert (\"The selected option is \" + selectedOption.value);
}//alert is only for testing
</script>
<?php
echo"<SELECT onChange=\"quantityfunction(this)\">";
while($temp<101)
{
echo"<OPTION VALUE='$item-$temp'>$temp";
$temp++;
}
</select>
?>