Email Validation Using PHP
Submitted by alpha_luna on Saturday, May 21, 2016 - 15:42.
Email Validation Using PHP
In this tutorial, we are going to learn on Email Validation Using PHP. Using PHP scripts is safe and secure. It accepted a valid email only.!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$
Using this PHP script is only accept the valid email address.
Do you need to validate or verify an email address? To verify the validity of your email address simply enter your email address into the textbox provided and the validation tool will do the rest. Kindly click "Download Code" below to have this simple tool.
Directions:
First: Kindly copy this code to your HEAD section of your page.- <style type="text/css">
- .container{
- border:2px ridge #CCCCCC;
- border-radius:5px;
- width:400px;
- margin:0 auto;
- padding:25px;
- font-family:Verdana, Geneva, sans-serif;
- font-size:12px;
- float:left;
- }
- .error{
- color:chocolate;
- font-weight:bold;
- }
- .text_style {
- font-size: 15px;
- color: blue;
- font-weight: bold;
- }
- .text_box {
- text-indent: 10px;
- width: 200px;
- height: 30px;
- border: 2px solid #D9D9D9;
- font-size: 15px;
- }
- .btn_style {
- width: 100px;
- float: right;
- margin-right: 26px;
- font-size: 15px;
- background: rgba(0,0,0,.6);
- color: #fff;
- cursor: pointer;
- border-radius: 5px;
- height: 30px;
- }
- </style>
- <?php
- error_reporting(0);
- if(isset($_POST['enter'])){
- $email=$_POST['email'];
- if($email==""){ $err="* Enter your email address...";}
- else{
- if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){
- $err = "* Email Address Syntax is not correct..."; }
- else{ $err="* Email Address Syntax is correct...";}
- }}?>
- <div class="container">
- <form method="post">
- <p align="center" class="error">
- <?php echo $err; ?>
- </p>
- <p align="center">
- <input type="text" class="text_box" name="email" placeholder="Email Address...">
- </p>
- <p align="center">
- <input type="submit" class="btn_style" name="enter" value="Check">
- </p>
- </form>
- </div>
Add new comment
- 84 views