如何使用MySQL数据库验证在PHP中使用表单输入的数据 [英] How can I validate data that entered using a form in PHP using a MySQL database

查看:103
本文介绍了如何使用MySQL数据库验证在PHP中使用表单输入的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何验证从表单输入的数据并在MySQL中使用数据?

How can I validate data that entered from a form and using the data in MySQL?

推荐答案

关于验证从表单输入的数据将取决于类型数据是否是日期,字符串,整数等.您可以检查该字段是否为空.
例如
如果您的表单是使用邮寄方式提交的,且提交的名称是"Fname",
然后
About validating data entered from the form it will depend on the type of data whether it is a date, a string , an integer etc. You can check to see if the field is empty.
e.g
if your form is submitted using post and filed name is "Fname",
then
if(


_POST[''Fname''] == " ") echo "Fname field cannot be empty"; ?>
_POST[''Fname''] == " ") echo "Fname field cannot be empty"; ?>



希望对您有帮助



Hope this helps


这篇关于如何使用MySQL数据库验证在PHP中使用表单输入的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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