验证表单输入数据 [英] Validating form input data
问题描述
大家好,
我想用一种优雅的方式处理一些来自表格的输入数据。当用户点击提交按钮时,我希望表格再次出现,并且已填入已输入的有效数据并提示
用户重新输入输入无效数据。如果所有数据都有效,我将转发到另一个.php页面,该页面将数据输入数据库。
我试图在以下方式:表单总是回击
本身,但是当所有数据都有效时,我使用PHP:header()重定向到执行的
data.php数据库插入。问题是数据
不能用于$ _POST变量中的data.php。我怎样才能克服这个问题?
问题?处理整个事情的任何其他微妙方式?任何帮助
赞赏。
Hello everyone,
I am tying to come up with an elegant way to process some input data that
come from a form. When the user hits the ''Submit'' button, i want the form to
appear again with the already entered valid data filled in and prompt the
user to re-enter the non-valid data. If all data is valid, i will forward to
an other .php page which enters the data into a database.
I tried to do this in the following way: the form always hits back on
itself, but when all data is valid i use the PHP:header() to redirect to the
data.php that performs the database insertion. The problem is that the data
is not available to data.php in the $_POST variable. How can i overcome this
problem? Any other subtle way to handle the whole thing? Any help
appreciated.
推荐答案
_POST变量。我怎样才能克服这个问题?
问题?处理整个事情的任何其他微妙方式?任何帮助
赞赏。
_POST variable. How can i overcome this
problem? Any other subtle way to handle the whole thing? Any help
appreciated.
stathis gotsis写道:
stathis gotsis wrote:
大家好,
我想要提出一种优雅的方法来处理来自表单的输入数据。当用户点击提交按钮时,我希望表格再次出现,并填写已输入的有效数据,并提示
用户重新输入无效数据。如果所有数据都有效,我将转发到另一个.php页面,该页面将数据输入数据库。
我尝试按以下方式执行此操作:表单始终返回
本身,但是当所有数据都有效时,我使用PHP:header()重定向到执行数据库插入的
data.php。问题是
Hello everyone,
I am tying to come up with an elegant way to process some input data that
come from a form. When the user hits the ''Submit'' button, i want the form to
appear again with the already entered valid data filled in and prompt the
user to re-enter the non-valid data. If all data is valid, i will forward to
an other .php page which enters the data into a database.
I tried to do this in the following way: the form always hits back on
itself, but when all data is valid i use the PHP:header() to redirect to the
data.php that performs the database insertion. The problem is that the data
is not available to data.php in the
_POST变量中的data.php无法获得数据。我怎样才能克服这个问题呢?处理整个事情的任何其他微妙方式?任何帮助
赞赏。
_POST variable. How can i overcome this
problem? Any other subtle way to handle the whole thing? Any help
appreciated.
我会稍微改变一下这个功能。
1 。有一个对
I would break the function a little differently.
1. Have a form (view) that is sensitive to
这篇关于验证表单输入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!