I have tested all the code, it is fine except calc_price()
that isn't executed even when I deleted all the code in function body except message.
<?php
include("header.php");
?>
<script type="text/javascript">
function calc_price()
{
alert('ooooooooooooooooooooooooooooo');
var pro_qty=<?php echo($row['pro_qty']);?>;
var price=document.getElementById('pro_price').value;
var count=document.getElementById('pro_qty').value;
var total_price;
if(count>pro_qty)
{alert('تعداد موجودی انبار کمتر از درخواست شماست');
document.getElementById('pro_qty').value=0;
count=0;
}
if(count==0 || count='') total_price=0;
else total_price=count*price;
document.getElementById('total_price').value=total_price;
}
</script>
<form action="action_order.php" method="post" name="order">
<p>
<label for="textfield3">تعداد درخواستی</label>
<input type="text" name="pro_qty" id="pro_qty" onChange="calc_price();">
</p>
<input type="submit" name="button" id="button" value="خرید محصول">
</p>
</form>
<?php
include("footer.php");
?>