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 thename
attribute or the php to correct that.解决 无用评论 打赏 举报
悬赏问题
- ¥20 西门子S7-Graph,S7-300,梯形图
- ¥50 用易语言http 访问不了网页
- ¥50 safari浏览器fetch提交数据后数据丢失问题
- ¥15 matlab不知道怎么改,求解答!!
- ¥15 永磁直线电机的电流环pi调不出来
- ¥15 用stata实现聚类的代码
- ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
- ¥20 docker里部署springboot项目,访问不到扬声器
- ¥15 netty整合springboot之后自动重连失效
- ¥15 悬赏!微信开发者工具报错,求帮改