Javascript 如何使用PHP验证表单和显示验证消息

Javascript 如何使用PHP验证表单和显示验证消息,javascript,php,forms,validation,Javascript,Php,Forms,Validation,我需要验证我的表单字段,并使用PHP的工具提示显示它们。我在下面解释我的代码 index.php: 在上面的代码中,当用户单击“添加”按钮时,我需要检查字段是否为空、电子邮件格式和图像格式。验证消息应显示在工具提示中。当所有验证成功时,所有字段值都可以收集和提交。请帮助我。没有人会为您编写任何验证。不过,您可以查看ppl已经制作的一些库,例如位于的欧芹。这是一个很好的web表单验证程序,请查看此链接 <form name="billdata" id="billdata" enctype=

我需要验证我的表单字段,并使用PHP的工具提示显示它们。我在下面解释我的代码

index.php:


在上面的代码中,当用户单击“添加”按钮时,我需要检查字段是否为空、电子邮件格式和图像格式。验证消息应显示在工具提示中。当所有验证成功时,所有字段值都可以收集和提交。请帮助我。

没有人会为您编写任何验证。不过,您可以查看ppl已经制作的一些库,例如位于的欧芹。这是一个很好的web表单验证程序,请查看此链接
<form name="billdata" id="billdata"  enctype="multipart/form-data" >
<div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px"> Name :</span>
<input type="text" name="u_name" id="name" class="form-control" placeholder="Add Catagory">
</div> 
<span class="error" id="nameError" style="display:none;">* <?php echo $nameErr;?></span>
 <div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px">Email :</span>
<input type="email" name="u_email" id="emailid" class="form-control" placeholder="Add Email Id">
</div>
<div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px">Mobile No :</span>
<input type="text" name="u_mobile_no" id="mobno" class="form-control" placeholder="Add Mobile No">
 </div>
<div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px">TYPE OF COMPLAINT
 :</span>
<select class="form-control"  id="compleant">
<option value="">Select types of complaint</option>
<option value="card">Card Related</option>
<option value="claim">Claim Related</option>
<option value="product">Product Related</option>
<option value="Premimum">Premimum Related</option>
</select>
</div>
<div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px">Upload Image :</span>

 <input type="file" class="filestyle form-control" data-size="lg" name="uploadme" id="bannerimage">
</div>
<div class="input-group bmargindiv1 text-right col-md-12" style="display:none;">
<img src="" name="pro" border="0" style="width:50px; height:50px; border:#808080 1px solid;" />
</div>
 <input type="button" class="btn btn-success" name="complainSubmit"  id="addProfileData" value="Add"/>
</form>

<?php
if(isset($_POST['complainSubmit']) || isset($_REQUEST['appsubmit']))
{
        $name=$_REQUEST['u_name'];


}
?>