You validate your data with javascript, before sending them to the server.
Example:
<form id="contact_form" method="post" enctype="multipart/form-data" action="contact.php" >
<input type="text" value="" name="name" id="name" />
<input type="text" value="" name="email" id="email" />
<input type="text" value="" name="phone" id="phone" />
<textarea name="comments" id="comments"></textarea>
<input type="button" class="submit_button" value="SUBMIT" onclick="return validate_contact();" />
</form>
And in javascript:
function validate_contact(){
var name=jQuery.trim($('#name').val());
var email=jQuery.trim($('#email').val());
var comments=jQuery.trim($('#comments').val());
if (name=='' || name.length<3)
{alert ('Please enter your name');return false;}
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)==false)
{alert('Please enter valid email address');return false;}
if (comments.length<1)
{alert('Please enter your comments');return false;}
}
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|