如何通过jqueryinphp验证表单 [英] how to validate the form through jqueryinphp

查看:98
本文介绍了如何通过jqueryinphp验证表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我,我想在我的php文件中使用aj查询验证

解决方案

这个问题毫无意义,因为你可以选择在客户端进行验证,服务器端,或两者兼而有之选择取决于很多因素,所以只有你能做出决定;它取决于可以表达数据有效性的知识。



其中一个因素非常重要:出于安全原因,您不能依赖客户端验证。它根本不提供任何保护,因为绕过这种验证的HTTP请求可以很容易地,非常容易伪造。在与安全相关的问题中,您只能依赖服务器端导航。



如果要在服务器端验证,可以使用PHP。发布数据后,您可以使用


_POST 并将任何逻辑应用于您获得的值。您可以使用键值对发布数据: http://php.net/manual/en/reserved。 variables.post.php [ ^ ]。



对于客户端验证,使用JavaScript,您可以在提交表单之前验证输入控件的值。请参阅,例如:

http://jqueryvalidation.org [ ^ ],

https: //plugins.jquery.com/validation [ ^ ]。



另见 http://bfy.tw/1MHb [ ^ ]。



-SA

plese help me i want to use a j query validation in my php file

解决方案

The question makes no sense, because you can choose to validate on client side, server side, or both. The choice depends on many factors, so only you can make a decision; it depends on where the knowledge on the data validity can be expressed.

One of the factors is really critical: you cannot rely on client-side validation used for security reason. It would provide no protection at all, because the HTTP request bypassing such validation can be easily, really easily forged. In secure-related issues, you can only rely on server-side navigation.

If you want to validate on server side, you can use PHP. After the data is posted, you can use


_POST and apply any logic to the values you get. You get post data in key-value pairs: http://php.net/manual/en/reserved.variables.post.php[^].

For clien-side validation, with JavaScript, you can validate the values of your input controls before the form is submitted. Please see, for example:
http://jqueryvalidation.org[^],
https://plugins.jquery.com/validation[^].

See also http://bfy.tw/1MHb[^].

—SA


这篇关于如何通过jqueryinphp验证表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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