1)The user will click the button after each list. 2)onclick the button will send the selected value to a javascript function 3)I want to take the value in the javascript function and send to a php file using ajax
Question How do I send html selected value to a javascript function using onclick?
<select id="list">
<option value=" ">Select a Name </option>
<option value="Comfy">Comfy</option>
<option value="Tough">William Tough </option>
<option value="Soft">Soft</option>
</select>
<button onclick="updateDB(this.querySelector('list'.selected))">Click Me</button>
<select id="list2">
<option value=" ">Select a Name </option>
<option value="Comfy">Comfy</option>
<option value="Tough">William Tough </option>
<option value="Soft">Soft</option>
</select>
<button onclick="updateDB(this.querySelector('list2'.selected))">Click Me</button>
Javascript function:
function updateDB(number)
{
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","/updatequery.php?numbers",true);
xmlhttp.send();
}
oci_execute()returnsbool. @Nameishi Check examples for how to fetch php.net/manual/en/function.oci-execute.php. Did you look anywhere before asking?