验证中的PHP问题 [英] PHP Problem in Validating

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

问题描述





我有一个如下表格,在onsubmit中我添加了验证,并且还添加了操作。



我的问题是onsubmit和动作同时运行。首先我要验证表单,如果发生验证错误,则无需运行php或操作。如果没有错误,那么应该运行php或action。请帮帮我。



< form onsubmit =MM_validateForm()action =code_exec.phpmethod =postname =reg>

解决方案

使用javascript提交表单。验证后使用javascript代码在函数MM_validateForm()的末尾提交表单。在每次验证中添加return false部分。

Hi,

I have a form like below, in onsubmit I have added a validation and also, I have added action.

My problem is onsubmit and action are running at same time. First I want to validate the form, if there validation error occurred, no need to run the php or action. If there is no error then php or action should be run. Please help me.

<form onsubmit="MM_validateForm()" action="code_exec.php" method="post" name="reg">

解决方案

submit the form using the javascript.After the validation use the javascript code for submitting the form at the end of the function MM_validateForm().Add return false in each validation section.


这篇关于验证中的PHP问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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