문제

I am using a POST method with AJAX to send an integer value from a form to the php script to be inserted into a database. When I do this the value is always zero when I cast it e.g $int = (int)$_POST['total']; and $int = intval($_POST['total']); and when I do not cast it the $int variable is assigned a string, when I var_dump the $_POST i get array(1) { ["int"]=> string(2) "20" } returned to the screen. does anybody know how to help me?

도움이 되었습니까?

해결책

It would seem your variable is located in $_POST['int'] and not in $_POST['total']. So change the name attribute or the php to correct that.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top