Hii Guys. . i want to know that how we validate an email address which user enters in a field in a form.Please Give me the code. Jimmy Scott
Usually, the information you submit is checked on the server side and you will be asked to fix possible errors, if any. This procedure is called form validation.
For email validation ->It is done under the script tag in "javascript" -> you can divide the email validation in two parts ->first validate for empty text field -> validate using regular expressions in PHP for the symbols used in email id format and a valid domain name.
There are two ways to validate email viz 1>Using javascript (client side)2>Using any server side language In javascript function validate(form_id,email) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; var address = document.forms[form_id].elements[email].value; if(reg.test(address) == false) { alert('Invalid Email Address'); return false; } } .