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?
POST整数PHP AJAX
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
weixin_33747129 2014-04-07 17:25关注It would seem your variable is located in
$_POST['int']and not in$_POST['total']. So change thenameattribute or the php to correct that.解决 无用评论 打赏 举报