数组操作,仅允许文本字段中的数字条目 [英] Array Manipulation , allowing only numeric entries in Text field

查看:52
本文介绍了数组操作,仅允许文本字段中的数字条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个网页,人们可以在网上订购图书。

i有一本阵列书,其中我存储了所有不同类型的书籍。

现在,我不希望用户订购任何垃圾(只是数字输入而不是字母)。

我该怎么办?

我使用了以下代码,但dint正常工作

展开 | 选择 | Wrap | 行号

解决方案

检查

_POST变量。[php] echo"< pre>" ;;

p rint_r(


_POST);

echo"< / pre>"; [/ php]


并使用 is_int 。[php] if(!is_int(


Hi all,
I have one webpage in which people can order books online.
i have one array - book , in which i have stored all different types of books.
Now, I dont want the user to order any garbage ( just numerical entry and not alphabetics ) .
How can I do so ??
I have used following code , but dint work proper

Expand|Select|Wrap|Line Numbers

解决方案

Check your


_POST variable.[php]echo "<pre>";
print_r(


_POST);
echo "</pre>";[/php]

And use is_int.[php]if (!is_int(


这篇关于数组操作,仅允许文本字段中的数字条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆