防止php在html表单脚本中过早执行
我在同一文件中的 html 表单代码下使用 php 代码制作了一个表单。在php代码部分,如果用户没有填写并提交所有重要字段数据,页面会回显“请填写所有字段”。令我烦恼的是,在用户单击提交按钮之前,就会显示“请填写所有字段”消息。我不希望在单击提交按钮之前回显任何内容,谢谢。
提前致谢。
I have made a form with the php code right under the html form code in the same file. In the php code section, the page will echo "please fill in all the fields" if the user does not fill in and submit all the important field data. Whats bugging me is that the "please fill in all the fields" message displays BEFORE the user even clicks the submit button. I don't want anything to echo out until after the submit button is clicked, thanks.
thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试这个
,其中“提交”是您的提交按钮的值。
也许添加类似
&& 的内容$_POST['important_field'] == ""
顺便说一句,您确实应该发布一些实际的代码。这会让事情变得容易一些。不过我认为你可以用这个来解决它。
You could try this
Where "submit" is the value of your submit button.
And maybe add something like
&& $_POST['important_field'] == ""
You really should have posted some actual code by the way. That would make it a bit easier. Nevertheless I think you can fix it with this.