<script type='text/javascript'>
function calculate(){
var text2answer = document.getElementById('Text2').value;
var answer=$quarity-text2answer;
alert( answer);
$sql= 'UPDATE `receved items` SET Quantity=answer where id=18';
echo $sql;
}
</script>";
I'm trying to update mysqli database inside JavaScript I have variable that calculated from textbox and get answer I want that answer from variable to update to mysql database please help